mux/src/look.cpp File Reference

#include "copyright.h"
#include "autoconf.h"
#include "config.h"
#include "externs.h"
#include "ansi.h"
#include "attrs.h"
#include "command.h"
#include "interface.h"
#include "powers.h"

Include dependency graph for look.cpp:

Go to the source code of this file.

Data Structures

struct  ATTR_DECODE_ENTRY

Defines

#define CONTENTS_LOCAL   0
#define CONTENTS_NESTED   1
#define CONTENTS_REMOTE   2

Typedefs

typedef struct ATTR_DECODE_ENTRYPATTR_DECODE_ENTRY

Functions

static void look_exits (dbref player, dbref loc, const char *exit_name)
static void look_contents (dbref player, dbref loc, const char *contents_name, int style)
size_t decode_attr_flags (int aflags, char *buff)
static void view_atr (dbref player, dbref thing, ATTR *ap, char *text, dbref aowner, int aflags, bool skip_tag)
static void look_atrs1 (dbref player, dbref thing, dbref othing, bool check_exclude, bool hash_insert)
static void look_atrs (dbref player, dbref thing, bool check_parents)
static bool show_a_desc (dbref player, dbref loc)
static void look_simple (dbref player, dbref thing, bool obey_terse)
static void show_desc (dbref player, dbref loc, int key)
void look_in (dbref player, dbref loc, int key)
void do_look (dbref executor, dbref caller, dbref enactor, int key, char *name)
static void debug_examine (dbref player, dbref thing)
static void exam_wildattrs (dbref player, dbref thing, bool do_parent)
void do_examine (dbref executor, dbref caller, dbref enactor, int key, char *name)
void do_score (dbref executor, dbref caller, dbref enactor, int key)
void do_inventory (dbref executor, dbref caller, dbref enactor, int key)
void do_entrances (dbref executor, dbref caller, dbref enactor, int key, char *name)
static void sweep_check (dbref player, dbref what, int key, bool is_loc)
void do_sweep (dbref executor, dbref caller, dbref enactor, int key, char *where)
void do_decomp (dbref executor, dbref caller, dbref enactor, int key, int nargs, char *name, char *qual)
void show_vrml_url (dbref thing, dbref loc)

Variables

static ATTR_DECODE_ENTRY attr_decode_table []


Define Documentation

#define CONTENTS_LOCAL   0

Definition at line 593 of file look.cpp.

Referenced by look_contents(), and look_in().

#define CONTENTS_NESTED   1

Definition at line 594 of file look.cpp.

Referenced by do_look(), and look_contents().

#define CONTENTS_REMOTE   2

Definition at line 595 of file look.cpp.

Referenced by do_examine(), and look_contents().


Typedef Documentation

typedef struct ATTR_DECODE_ENTRY * PATTR_DECODE_ENTRY


Function Documentation

static void debug_examine ( dbref  player,
dbref  thing 
) [static]

Definition at line 1434 of file look.cpp.

References A_LOCK, alloc_lbuf, atr_get, atr_get_info(), atr_head(), atr_next(), atr_num(), bCanReadAttr(), Contents, Exits, flag_description(), free_boolexp(), free_lbuf, free_mbuf, Good_obj, Link, Location, Name, Next, notify, Owner, parse_boolexp(), Pennies(), powers_list(), rxlevel_description(), safe_chr, safe_str, tprintf(), txlevel_description(), unparse_boolexp(), view_atr(), and Zone.

Referenced by do_examine().

01435 {
01436     dbref aowner;
01437     char *buf;
01438     int aflags, ca;
01439     BOOLEXP *pBoolExp;
01440     ATTR *pattr;
01441     char *as, *cp;
01442 
01443     notify(player, tprintf("Number  = %d", thing));
01444     if (!Good_obj(thing))
01445     {
01446         return;
01447     }
01448 
01449     notify(player, tprintf("Name    = %s", Name(thing)));
01450     notify(player, tprintf("Location= %d", Location(thing)));
01451     notify(player, tprintf("Contents= %d", Contents(thing)));
01452     notify(player, tprintf("Exits   = %d", Exits(thing)));
01453     notify(player, tprintf("Link    = %d", Link(thing)));
01454     notify(player, tprintf("Next    = %d", Next(thing)));
01455     notify(player, tprintf("Owner   = %d", Owner(thing)));
01456     notify(player, tprintf("Pennies = %d", Pennies(thing)));
01457     notify(player, tprintf("Zone    = %d", Zone(thing)));
01458     buf = flag_description(player, thing);
01459     notify(player, tprintf("Flags   = %s", buf));
01460     free_mbuf(buf);
01461     buf = powers_list(player, thing);
01462     notify(player, tprintf("Powers  = %s", buf));
01463     free_lbuf(buf);
01464 #ifdef REALITY_LVLS
01465     buf = rxlevel_description(player, thing);
01466     notify(player, tprintf("RxLevel = %s", buf));
01467     free_lbuf(buf);
01468     buf = txlevel_description(player, thing);
01469     notify(player, tprintf("TxLevel = %s", buf));
01470     free_lbuf(buf);
01471 #endif /* REALITY_LVLS */
01472     buf = atr_get(thing, A_LOCK, &aowner, &aflags);
01473     pBoolExp = parse_boolexp(player, buf, true);
01474     free_lbuf(buf);
01475     notify(player, tprintf("Lock    = %s", unparse_boolexp(player, pBoolExp)));
01476     free_boolexp(pBoolExp);
01477 
01478     buf = alloc_lbuf("debug_dexamine");
01479     cp = buf;
01480     safe_str("Attr list: ", buf, &cp);
01481 
01482     for (ca = atr_head(thing, &as); ca; ca = atr_next(&as))
01483     {
01484         pattr = atr_num(ca);
01485         if (!pattr)
01486         {
01487             continue;
01488         }
01489 
01490         atr_get_info(thing, ca, &aowner, &aflags);
01491         if (bCanReadAttr(player, thing, pattr, false))
01492         {
01493             if (pattr)
01494             {
01495                 // Valid attr.
01496                 //
01497                 safe_str(pattr->name, buf, &cp);
01498                 safe_chr(' ', buf, &cp);
01499             }
01500             else
01501             {
01502                 safe_str(tprintf("%d ", ca), buf, &cp);
01503             }
01504         }
01505     }
01506     *cp = '\0';
01507     notify(player, buf);
01508     free_lbuf(buf);
01509 
01510     for (ca = atr_head(thing, &as); ca; ca = atr_next(&as))
01511     {
01512         pattr = atr_num(ca);
01513         if (!pattr)
01514         {
01515             continue;
01516         }
01517 
01518         buf = atr_get(thing, ca, &aowner, &aflags);
01519         if (bCanReadAttr(player, thing, pattr, false))
01520         {
01521             view_atr(player, thing, pattr, buf, aowner, aflags, 0);
01522         }
01523         free_lbuf(buf);
01524     }
01525 }

size_t decode_attr_flags ( int  aflags,
char *  buff 
)

Definition at line 774 of file look.cpp.

References attr_decode_table, ATTR_DECODE_ENTRY::letter, and ATTR_DECODE_ENTRY::mask.

Referenced by FUNCTION(), and view_atr().

00775 {
00776     char *p = buff;
00777     PATTR_DECODE_ENTRY pEntry;
00778     for (pEntry = attr_decode_table; pEntry->mask; pEntry++)
00779     {
00780         if (aflags & pEntry->mask)
00781         {
00782             *p++ = pEntry->letter;
00783         }
00784     }
00785     *p = '\0';
00786     return p - buff;
00787 }

void do_decomp ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
int  nargs,
char *  name,
char *  qual 
)

Definition at line 2437 of file look.cpp.

References A_LOCK, A_NAME, A_USER_START, AF_IS_LOCK, AF_LOCK, AF_NOCMD, alloc_mbuf, atr_get, atr_head(), atr_next(), atr_num(), bCanReadAttr(), CA_NO_DECOMP, check_access(), DECOMP_DBREF, Examinable, EXIT_DELIMITER, name_table::flag, attr::flags, free_boolexp(), free_lbuf, indiv_attraccess_nametab, init_match(), MAT_EXIT_PARENTS, match_everything(), name_table::name, attr::name, Name, noisy_match_result(), NOTHING, notify, notify_quiet, OBJECT_DEPOSIT, olist_first(), olist_next(), olist_pop(), olist_push(), parse_attrib_wild(), parse_boolexp(), Pennies(), name_table::perm, strip_ansi(), tprintf(), translate_string(), TRUE_BOOLEXP, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, unparse_boolexp_decompile(), and UNUSED_PARAMETER.

02446 {
02447     UNUSED_PARAMETER(caller);
02448     UNUSED_PARAMETER(enactor);
02449     UNUSED_PARAMETER(nargs);
02450 
02451     BOOLEXP *pBoolExp;
02452     char *got, *thingname, *as, *ltext, *buff;
02453     dbref aowner, thing;
02454     int val, aflags, ca;
02455     ATTR *pattr;
02456     NAMETAB *np;
02457     bool wild_decomp;
02458 
02459     // Check for obj/attr first.
02460     //
02461     olist_push();
02462     if (parse_attrib_wild(executor, name, &thing, false, true, false))
02463     {
02464         wild_decomp = true;
02465     }
02466     else
02467     {
02468         wild_decomp = false;
02469         init_match(executor, name, TYPE_THING);
02470         match_everything(MAT_EXIT_PARENTS);
02471         thing = noisy_match_result();
02472     }
02473 
02474     // get result
02475     //
02476     if (thing == NOTHING)
02477     {
02478         olist_pop();
02479         return;
02480     }
02481 
02482     if (!Examinable(executor, thing))
02483     {
02484         notify_quiet(executor,
02485               "You can only decompile things you can examine.");
02486         olist_pop();
02487         return;
02488     }
02489 
02490     thingname = atr_get(thing, A_LOCK, &aowner, &aflags);
02491     pBoolExp = parse_boolexp(executor, thingname, true);
02492 
02493     // Determine the name of the thing to use in reporting and then
02494     // report the command to make the thing.
02495     //
02496     if (qual && *qual)
02497     {
02498         strcpy(thingname, qual);
02499     }
02500     else
02501     {
02502         if (key == DECOMP_DBREF)
02503         {
02504             strcpy(thingname, tprintf("#%d",thing));
02505         }
02506         else
02507         {
02508             switch (Typeof(thing))
02509             {
02510             case TYPE_THING:
02511                 strcpy(thingname, Name(thing));
02512                 val = OBJECT_DEPOSIT(Pennies(thing));
02513                 notify(executor,
02514                     tprintf("@create %s=%d", translate_string(thingname, true),
02515                     val));
02516                 break;
02517 
02518             case TYPE_ROOM:
02519                 strcpy(thingname, "here");
02520                 notify(executor, tprintf("@dig/teleport %s",
02521                     translate_string(Name(thing), true)));
02522                 break;
02523 
02524             case TYPE_EXIT:
02525                 strcpy(thingname, Name(thing));
02526                 notify(executor,
02527                     tprintf("@open %s", translate_string(thingname, true)));
02528                 for (got = thingname; *got; got++)
02529                 {
02530                     if (*got == EXIT_DELIMITER)
02531                     {
02532                         *got = '\0';
02533                         break;
02534                     }
02535                 }
02536                 break;
02537 
02538             case TYPE_PLAYER:
02539                 if (executor == thing)
02540                 {
02541                     strcpy(thingname, "me");
02542                 }
02543                 else
02544                 {
02545                     strcpy(thingname, Name(thing));
02546                 }
02547                 break;
02548             }
02549         }
02550     }
02551 
02552     // Strip out ANSI in one place rather than have it done in
02553     // several places.
02554     //
02555     size_t len;
02556     char *p = strip_ansi(thingname, &len);
02557     memcpy(thingname, p, len+1);
02558 
02559     // Report the lock (if any).
02560     //
02561     if (  !wild_decomp
02562        && pBoolExp != TRUE_BOOLEXP)
02563     {
02564         notify(executor, tprintf("@lock %s=%s", thingname,
02565             unparse_boolexp_decompile(executor, pBoolExp)));
02566     }
02567     free_boolexp(pBoolExp);
02568 
02569     // Report attributes.
02570     //
02571     buff = alloc_mbuf("do_decomp.attr_name");
02572     for (ca = (wild_decomp ? olist_first() : atr_head(thing, &as));
02573         (wild_decomp) ? (ca != NOTHING) : (ca != 0);
02574         ca = (wild_decomp ? olist_next() : atr_next(&as)))
02575     {
02576         if (  ca == A_NAME
02577            || ca == A_LOCK)
02578         {
02579             continue;
02580         }
02581         pattr = atr_num(ca);
02582         if (!pattr)
02583         {
02584             continue;
02585         }
02586         if (  (pattr->flags & AF_NOCMD)
02587            && !(pattr->flags & AF_IS_LOCK))
02588         {
02589             continue;
02590         }
02591 
02592         got = atr_get(thing, ca, &aowner, &aflags);
02593         if (bCanReadAttr(executor, thing, pattr, false))
02594         {
02595             if (pattr->flags & AF_IS_LOCK)
02596             {
02597                 pBoolExp = parse_boolexp(executor, got, true);
02598                 ltext = unparse_boolexp_decompile(executor, pBoolExp);
02599                 free_boolexp(pBoolExp);
02600                 notify(executor, tprintf("@lock/%s %s=%s", pattr->name,
02601                     thingname, ltext));
02602             }
02603             else
02604             {
02605                 strcpy(buff, pattr->name);
02606                 notify(executor, tprintf("%c%s %s=%s", ((ca < A_USER_START) ?
02607                     '@' : '&'), buff, thingname, got));
02608                 for (np = indiv_attraccess_nametab; np->name; np++)
02609                 {
02610                     if (  (aflags & np->flag)
02611                        && check_access(executor, np->perm)
02612                        && (!(np->perm & CA_NO_DECOMP)))
02613                     {
02614                         notify(executor, tprintf("@set %s/%s = %s", thingname,
02615                             buff, np->name));
02616                     }
02617                 }
02618 
02619                 if (aflags & AF_LOCK)
02620                 {
02621                     notify(executor, tprintf("@lock %s/%s", thingname, buff));
02622                 }
02623             }
02624         }
02625         free_lbuf(got);
02626     }
02627     free_mbuf(buff);
02628 
02629     if (!wild_decomp)
02630     {
02631         decompile_flags(executor, thing, thingname);
02632         decompile_powers(executor, thing, thingname);
02633 #ifdef REALITY_LVLS
02634         decompile_rlevels(executor, thing, thingname);
02635 #endif /* REALITY_LVLS */
02636     }
02637 
02638     // If the object has a parent, report it.
02639     //
02640     if (  !wild_decomp
02641        && (Parent(thing) != NOTHING))
02642     {
02643         notify(executor, tprintf("@parent %s=#%d", thingname, Parent(thing)));
02644     }
02645 
02646     // If the object has a zone, report it.
02647     //
02648     int zone;
02649     if (  !wild_decomp
02650        && Good_obj(zone = Zone(thing)))
02651     {
02652         notify(executor, tprintf("@chzone %s=#%d", thingname, zone));
02653     }
02654 
02655     free_lbuf(thingname);
02656     olist_pop();
02657 }

void do_entrances ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  name 
)

Definition at line 1995 of file look.cpp.

References alloc_lbuf, forward_list::count, forward_list::data, Dropto, Examinable, Exits, free_lbuf, fwdlist_get(), Good_obj, H_Fwdlist, Has_location, Home, init_match(), Location, confdata::many_coins, MAT_EXIT_PARENTS, match_everything(), mudconf, Name, noisy_match_result(), notify, NOTYPE, Parent, parse_range(), payfor(), confdata::searchcost, tprintf(), TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, unparse_object(), and UNUSED_PARAMETER.

01996 {
01997     UNUSED_PARAMETER(caller);
01998     UNUSED_PARAMETER(enactor);
01999     UNUSED_PARAMETER(key);
02000 
02001     dbref thing, i, j;
02002     char *exit, *message;
02003     int control_thing, count, low_bound, high_bound;
02004     FWDLIST *fp;
02005 
02006     parse_range(&name, &low_bound, &high_bound);
02007     if (  !name
02008        || !*name)
02009     {
02010         if (Has_location(executor))
02011         {
02012             thing = Location(executor);
02013         }
02014         else
02015         {
02016             thing = executor;
02017         }
02018         if (!Good_obj(thing))
02019         {
02020             return;
02021         }
02022     }
02023     else
02024     {
02025         init_match(executor, name, NOTYPE);
02026         match_everything(MAT_EXIT_PARENTS);
02027         thing = noisy_match_result();
02028         if (!Good_obj(thing))
02029         {
02030             return;
02031         }
02032     }
02033 
02034     if (!payfor(executor, mudconf.searchcost))
02035     {
02036         notify(executor, tprintf("You don't have enough %s.",
02037             mudconf.many_coins));
02038         return;
02039     }
02040     message = alloc_lbuf("do_entrances");
02041     control_thing = Examinable(executor, thing);
02042     count = 0;
02043     for (i = low_bound; i <= high_bound; i++)
02044     {
02045         if (control_thing || Examinable(executor, i))
02046         {
02047             switch (Typeof(i))
02048             {
02049             case TYPE_EXIT:
02050                 if (Location(i) == thing)
02051                 {
02052                     exit = unparse_object(executor, Exits(i), false);
02053                     notify(executor, tprintf("%s (%s)", exit, Name(i)));
02054                     free_lbuf(exit);
02055                     count++;
02056                 }
02057                 break;
02058             case TYPE_ROOM:
02059                 if (Dropto(i) == thing)
02060                 {
02061                     exit = unparse_object(executor, i, false);
02062                     notify(executor, tprintf("%s [dropto]", exit));
02063                     free_lbuf(exit);
02064                     count++;
02065                 }
02066                 break;
02067             case TYPE_THING:
02068             case TYPE_PLAYER:
02069                 if (Home(i) == thing)
02070                 {
02071                     exit = unparse_object(executor, i, false);
02072                     notify(executor, tprintf("%s [home]", exit));
02073                     free_lbuf(exit);
02074                     count++;
02075                 }
02076                 break;
02077             }
02078 
02079             // Check for parents.
02080             //
02081             if (Parent(i) == thing)
02082             {
02083                 exit = unparse_object(executor, i, false);
02084                 notify(executor, tprintf("%s [parent]", exit));
02085                 free_lbuf(exit);
02086                 count++;
02087             }
02088 
02089             // Check for forwarding.
02090             //
02091             if (H_Fwdlist(i))
02092             {
02093                 fp = fwdlist_get(i);
02094                 if (!fp)
02095                 {
02096                     continue;
02097                 }
02098                 for (j = 0; j < fp->count; j++)
02099                 {
02100                     if (fp->data[j] != thing)
02101                     {
02102                         continue;
02103                     }
02104                     exit = unparse_object(executor, i, false);
02105                     notify(executor, tprintf("%s [forward]", exit));
02106                     free_lbuf(exit);
02107                     count++;
02108                 }
02109             }
02110         }
02111     }
02112     free_lbuf(message);
02113     notify(executor, tprintf("%d entrance%s found.", count,
02114         (count == 1) ? "" : "s"));
02115 }

void do_examine ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key,
char *  name 
)

Definition at line 1599 of file look.cpp.

References A_DESC, A_LOCK, alloc_lbuf, atr_get, atr_get_str(), atr_num(), Contents, CONTENTS_REMOTE, debug_examine(), DOLIST, Dropto, confdata::ex_flags, EXAM_BRIEF, EXAM_DEBUG, EXAM_DEFAULT, EXAM_PARENT, confdata::exam_public, exam_wildattrs(), Examinable, Exits, flag_description(), free_boolexp(), free_lbuf, free_mbuf, Good_obj, Has_contents, confdata::have_zones, Hearer(), Home, init_match(), isExit, Link_exit, Linkable, Location, look_atrs(), look_contents(), look_exits(), confdata::many_coins, MAT_EXIT_PARENTS, match_everything(), mudconf, mux_toupper, Name, nearby(), noisy_match_result(), NOMATCH_MESSAGE, NOPERM_MESSAGE, NOTHING, notify, notify_quiet, NOTYPE, olist_pop(), olist_push(), Opaque, Owner, Parent, parse_attrib_wild(), parse_boolexp(), Pennies(), powers_list(), confdata::read_rem_desc, confdata::read_rem_name, rxlevel_description(), show_desc(), tprintf(), txlevel_description(), TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, unparse_boolexp(), unparse_object(), UNUSED_PARAMETER, view_atr(), and Zone.

01600 {
01601     UNUSED_PARAMETER(caller);
01602     UNUSED_PARAMETER(enactor);
01603 
01604     // This command is pointless if the player can't hear.
01605     //
01606     if (!Hearer(executor))
01607     {
01608         return;
01609     }
01610 
01611     dbref content, exit, aowner, loc;
01612     char savec;
01613     char *temp, *buf, *buf2;
01614     BOOLEXP *pBoolExp;
01615     int aflags;
01616     bool control;
01617     bool do_parent = ((key & EXAM_PARENT) ? true : false);
01618 
01619     dbref thing = NOTHING;
01620     if (  !name
01621        || !*name)
01622     {
01623         thing = Location(executor);
01624         if (thing == NOTHING)
01625         {
01626             return;
01627         }
01628     }
01629     else
01630     {
01631         // Check for obj/attr first.
01632         //
01633         olist_push();
01634         if (parse_attrib_wild(executor, name, &thing, do_parent, true, false))
01635         {
01636             exam_wildattrs(executor, thing, do_parent);
01637             olist_pop();
01638             return;
01639         }
01640         olist_pop();
01641 
01642         // Look it up.
01643         //
01644         init_match(executor, name, NOTYPE);
01645         match_everything(MAT_EXIT_PARENTS);
01646         thing = noisy_match_result();
01647         if (!Good_obj(thing))
01648         {
01649             return;
01650         }
01651     }
01652 
01653 #if defined(WOD_REALMS) || defined(REALITY_LVLS)
01654     if (REALM_DO_HIDDEN_FROM_YOU == DoThingToThingVisibility(executor, thing, ACTION_IS_STATIONARY))
01655     {
01656         notify(executor, NOMATCH_MESSAGE);
01657         return;
01658     }
01659 #endif
01660 
01661     // Check for the /debug switch.
01662     //
01663     if (key & EXAM_DEBUG)
01664     {
01665         if (!Examinable(executor, thing))
01666         {
01667             notify_quiet(executor, NOPERM_MESSAGE);
01668         }
01669         else
01670         {
01671             debug_examine(executor, thing);
01672         }
01673         return;
01674     }
01675     control = (  Examinable(executor, thing)
01676               || Link_exit(executor, thing));
01677 
01678     if (control)
01679     {
01680         buf2 = unparse_object(executor, thing, false);
01681         notify(executor, buf2);
01682         free_lbuf(buf2);
01683         if (mudconf.ex_flags)
01684         {
01685             buf2 = flag_description(executor, thing);
01686             notify(executor, buf2);
01687             free_mbuf(buf2);
01688         }
01689     }
01690     else
01691     {
01692         if (  key == EXAM_DEFAULT
01693            && !mudconf.exam_public)
01694         {
01695             if (mudconf.read_rem_name)
01696             {
01697                 buf2 = alloc_lbuf("do_examine.pub_name");
01698                 strcpy(buf2, Name(thing));
01699                 notify(executor,
01700                     tprintf("%s is owned by %s",
01701                     buf2, Name(Owner(thing))));
01702                 free_lbuf(buf2);
01703             }
01704             else
01705             {
01706                 notify(executor, tprintf("Owned by %s", Name(Owner(thing))));
01707             }
01708             return;
01709         }
01710     }
01711 
01712     temp = alloc_lbuf("do_examine.info");
01713 
01714     if (  control
01715        || mudconf.read_rem_desc
01716        || nearby(executor, thing))
01717     {
01718         temp = atr_get_str(temp, thing, A_DESC, &aowner, &aflags);
01719         if (*temp)
01720         {
01721             if (  Examinable(executor, thing)
01722                || (aowner == Owner(executor)))
01723             {
01724                 view_atr(executor, thing, atr_num(A_DESC), temp,
01725                     aowner, aflags, true);
01726             }
01727             else
01728             {
01729                 show_desc(executor, thing, 0);
01730             }
01731         }
01732     }
01733     else
01734     {
01735         notify(executor, "<Too far away to get a good look>");
01736     }
01737 
01738     if (control)
01739     {
01740         // Print owner, key, and value.
01741         //
01742         savec = mudconf.many_coins[0];
01743         mudconf.many_coins[0] = mux_toupper(mudconf.many_coins[0]);
01744         buf2 = atr_get(thing, A_LOCK, &aowner, &aflags);
01745         pBoolExp = parse_boolexp(executor, buf2, true);
01746         buf = unparse_boolexp(executor, pBoolExp);
01747         free_boolexp(pBoolExp);
01748         strcpy(buf2, Name(Owner(thing)));
01749         notify(executor, tprintf("Owner: %s  Key: %s %s: %d", buf2, buf, mudconf.many_coins, Pennies(thing)));
01750         free_lbuf(buf2);
01751         mudconf.many_coins[0] = savec;
01752 
01753         // Print the zone
01754         //
01755         if (mudconf.have_zones)
01756         {
01757             buf2 = unparse_object(executor, Zone(thing), false);
01758             notify(executor, tprintf("Zone: %s", buf2));
01759             free_lbuf(buf2);
01760         }
01761 
01762         // Print parent
01763         //
01764         loc = Parent(thing);
01765         if (loc != NOTHING)
01766         {
01767             buf2 = unparse_object(executor, loc, false);
01768             notify(executor, tprintf("Parent: %s", buf2));
01769             free_lbuf(buf2);
01770         }
01771         buf2 = powers_list(executor, thing);
01772         notify(executor, tprintf("Powers: %s", buf2));
01773         free_lbuf(buf2);
01774 #ifdef REALITY_LVLS
01775         /* Show Rx and Tx levels */
01776 
01777         buf2 = rxlevel_description(executor, thing);
01778         notify(executor, tprintf("RxLevel: %s", buf2));
01779         free_mbuf(buf2);
01780         buf2 = txlevel_description(executor, thing);
01781         notify(executor, tprintf("TxLevel: %s", buf2));
01782         free_mbuf(buf2);
01783 #endif /* REALITY_LVLS */
01784     }
01785     if (!(key & EXAM_BRIEF))
01786     {
01787         look_atrs(executor, thing, do_parent);
01788     }
01789 
01790     // Show him interesting stuff
01791     //
01792     if (control)
01793     {
01794         // Contents
01795         //
01796         if (Contents(thing) != NOTHING)
01797         {
01798             notify(executor, "Contents:");
01799             DOLIST(content, Contents(thing))
01800             {
01801                 buf2 = unparse_object(executor, content, false);
01802                 notify(executor, buf2);
01803                 free_lbuf(buf2);
01804             }
01805         }
01806 
01807         // Show stuff that depends on the object type.
01808         //
01809         switch (Typeof(thing))
01810         {
01811         case TYPE_ROOM:
01812             // Tell him about exits
01813             //
01814             if (Exits(thing) != NOTHING)
01815             {
01816                 notify(executor, "Exits:");
01817                 DOLIST(exit, Exits(thing))
01818                 {
01819                     buf2 = unparse_object(executor, exit, false);
01820                     notify(executor, buf2);
01821                     free_lbuf(buf2);
01822                 }
01823             }
01824             else
01825             {
01826                 notify(executor, "No exits.");
01827             }
01828 
01829             // print dropto if present
01830             //
01831             if (Dropto(thing) != NOTHING)
01832             {
01833                 buf2 = unparse_object(executor, Dropto(thing), false);
01834                 notify(executor, tprintf("Dropped objects go to: %s", buf2));
01835                 free_lbuf(buf2);
01836             }
01837             break;
01838 
01839         case TYPE_THING:
01840         case TYPE_PLAYER:
01841 
01842             // Tell him about exits
01843             //
01844             if (Exits(thing) != NOTHING)
01845             {
01846                 notify(executor, "Exits:");
01847                 DOLIST(exit, Exits(thing))
01848                 {
01849                     buf2 = unparse_object(executor, exit, false);
01850                     notify(executor, buf2);
01851                     free_lbuf(buf2);
01852                 }
01853             }
01854             else
01855             {
01856                 notify(executor, "No exits.");
01857             }
01858 
01859             // Print home
01860             //
01861             loc = Home(thing);
01862             buf2 = unparse_object(executor, loc, false);
01863             notify(executor, tprintf("Home: %s", buf2));
01864             free_lbuf(buf2);
01865 
01866             // print location if player can link to it
01867             //
01868             loc = Location(thing);
01869             if (  Location(thing) != NOTHING
01870                && (  Examinable(executor, loc)
01871                   || Examinable(executor, thing)
01872                   || Linkable(executor, loc)))
01873             {
01874                 buf2 = unparse_object(executor, loc, false);
01875                 notify(executor, tprintf("Location: %s", buf2));
01876                 free_lbuf(buf2);
01877             }
01878             break;
01879 
01880         case TYPE_EXIT:
01881             buf2 = unparse_object(executor, Exits(thing), false);
01882             notify(executor, tprintf("Source: %s", buf2));
01883             free_lbuf(buf2);
01884 
01885             // print destination.
01886             //
01887             switch (Location(thing))
01888             {
01889             case NOTHING:
01890                 // Special case. unparse_object() normally returns -1 as '*NOTHING*'.
01891                 //
01892                 notify(executor, "Destination: *UNLINKED*");
01893                 break;
01894 
01895             default:
01896                 buf2 = unparse_object(executor, Location(thing), false);
01897                 notify(executor, tprintf("Destination: %s", buf2));
01898                 free_lbuf(buf2);
01899                 break;
01900             }
01901             break;
01902 
01903         default:
01904             break;
01905         }
01906     }
01907     else if (  !Opaque(thing)
01908             && nearby(executor, thing))
01909     {
01910         if (Has_contents(thing))
01911         {
01912             look_contents(executor, thing, "Contents:", CONTENTS_REMOTE);
01913         }
01914         if (!isExit(thing))
01915         {
01916             look_exits(executor, thing, "Obvious exits:");
01917         }
01918     }
01919     free_lbuf(temp);
01920 
01921     if (!control)
01922     {
01923         if (mudconf.read_rem_name)
01924         {
01925             buf2 = alloc_lbuf("do_examine.pub_name");
01926             strcpy(buf2, Name(thing));
01927             notify(executor, tprintf("%s is owned by %s", buf2, Name(Owner(thing))));
01928             free_lbuf(buf2);
01929         }
01930         else
01931         {
01932             notify(executor, tprintf("Owned by %s", Name(Owner(thing))));
01933         }
01934     }
01935 }

void do_inventory ( dbref  executor,
dbref  caller,
dbref  enactor,
int  key 
)

Definition at line 1948 of file look.cpp.

References alloc_lbuf, Contents, do_score(), DOLIST, Exits, free_lbuf, Name, NOTHING, notify, safe_chr, safe_str, unparse_object(), and UNUSED_PARAMETER.

01949 {
01950     UNUSED_PARAMETER(enactor);
01951     UNUSED_PARAMETER(key);
01952 
01953     dbref thing;
01954     char *buff, *e;
01955     const char *s;
01956 
01957     thing = Contents(executor);
01958     if (thing == NOTHING)
01959     {
01960         notify(executor, "You aren't carrying anything.");
01961     }
01962     else
01963     {
01964         notify(executor, "You are carrying:");
01965