#include "copyright.h"
#include "config.h"
#include "mudconf.h"
#include "db.h"
#include "interface.h"
#include "match.h"
#include "externs.h"
#include "flags.h"
#include "powers.h"
#include "attrs.h"
#include "command.h"
#include "alloc.h"
#include "ansi.h"
Include dependency graph for look.c:
Go to the source code of this file.
Defines | |
#define | CONTENTS_LOCAL 0 |
#define | CONTENTS_NESTED 1 |
#define | CONTENTS_REMOTE 2 |
Functions | |
void | ufun (char *, char *, int, int, int, dbref, dbref) |
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) |
static void | view_atr (dbref player, dbref thing, ATTR *ap, char *text, dbref aowner, int aflags, int skip_tag) |
static void | look_atrs1 (dbref player, dbref thing, dbref othing, int check_exclude, int hash_insert) |
static void | look_atrs (dbref player, dbref thing, int check_parents) |
static void | look_simple (dbref player, dbref thing, int obey_terse) |
static void | show_a_desc (dbref player, dbref loc) |
static void | show_desc (dbref player, dbref loc, int key) |
void | look_in (dbref player, dbref loc, int key) |
void | do_look (dbref player, dbref cause, int key, char *name) |
static void | debug_examine (dbref player, dbref thing) |
static void | exam_wildattrs (dbref player, dbref thing, int do_parent) |
void | do_examine (dbref player, dbref cause, int key, char *name) |
void | do_score (dbref player, dbref cause, int key) |
void | do_inventory (dbref player, dbref cause, int key) |
void | do_entrances (dbref player, dbref cause, int key, char *name) |
static void | sweep_check (dbref player, dbref what, int key, int is_loc) |
void | do_sweep (dbref player, dbref cause, int key, char *where) |
void | do_decomp (dbref player, dbref cause, int key, char *name, char *qual) |
Variables | |
NAMETAB | indiv_attraccess_nametab [] |
#define CONTENTS_REMOTE 2 |
Definition at line 505 of file look.c.
References A_LOCK, alloc_lbuf, atr_get(), atr_get_info(), atr_head(), atr_next(), atr_num(), attr, Contents, Exits, flag_description(), free_boolexp(), free_lbuf, free_mbuf, Good_obj, Link, Location, Name(), Next, notify, notify_printf(), Owner, parse_boolexp(), Pennies(), power_description(), Read_attr, safe_chr, safe_str, tprintf(), unparse_boolexp(), view_atr(), and Zone.
Referenced by do_examine().
00506 { 00507 dbref aowner; 00508 char *buf; 00509 int aflags, ca; 00510 BOOLEXP *bool; 00511 ATTR *attr; 00512 char *as, *cp; 00513 00514 notify_printf(player, "Number = %d", thing); 00515 if(!Good_obj(thing)) 00516 return; 00517 00518 notify_printf(player, "Name = %s", Name(thing)); 00519 notify_printf(player, "Location= %d", Location(thing)); 00520 notify_printf(player, "Contents= %d", Contents(thing)); 00521 notify_printf(player, "Exits = %d", Exits(thing)); 00522 notify_printf(player, "Link = %d", Link(thing)); 00523 notify_printf(player, "Next = %d", Next(thing)); 00524 notify_printf(player, "Owner = %d", Owner(thing)); 00525 notify_printf(player, "Pennies = %d", Pennies(thing)); 00526 notify_printf(player, "Zone = %d", Zone(thing)); 00527 buf = flag_description(player, thing); 00528 notify_printf(player, "Flags = %s", buf); 00529 free_mbuf(buf); 00530 buf = power_description(player, thing); 00531 notify_printf(player, "Powers = %s", buf); 00532 free_mbuf(buf); 00533 buf = atr_get(thing, A_LOCK, &aowner, &aflags); 00534 bool = parse_boolexp(player, buf, 1); 00535 free_lbuf(buf); 00536 notify_printf(player, "Lock = %s", unparse_boolexp(player, bool)); 00537 free_boolexp(bool); 00538 00539 buf = alloc_lbuf("debug_dexamine"); 00540 cp = buf; 00541 safe_str((char *) "Attr list: ", buf, &cp); 00542 00543 for(ca = atr_head(thing, &as); ca; ca = atr_next(&as)) { 00544 attr = atr_num(ca); 00545 if(!attr) 00546 continue; 00547 00548 atr_get_info(thing, ca, &aowner, &aflags); 00549 if(Read_attr(player, thing, attr, aowner, aflags)) { 00550 if(attr) { /* 00551 * Valid attr. 00552 */ 00553 safe_str((char *) attr->name, buf, &cp); 00554 safe_chr(' ', buf, &cp); 00555 } else { 00556 safe_str(tprintf("%d ", ca), buf, &cp); 00557 } 00558 } 00559 } 00560 *cp = '\0'; 00561 notify(player, buf); 00562 free_lbuf(buf); 00563 00564 for(ca = atr_head(thing, &as); ca; ca = atr_next(&as)) { 00565 attr = atr_num(ca); 00566 if(!attr) 00567 continue; 00568 00569 buf = atr_get(thing, ca, &aowner, &aflags); 00570 if(Read_attr(player, thing, attr, aowner, aflags)) 00571 view_atr(player, thing, attr, buf, aowner, aflags, 0); 00572 free_lbuf(buf); 00573 } 00574 }
Definition at line 1261 of file look.c.
References A_LOCK, A_NAME, A_USER_START, AF_IS_LOCK, AF_LOCK, alloc_lbuf, alloc_mbuf, atr_get(), atr_num(), attr, CA_NO_DECOMP, check_access(), DECOMP_DBREF, EXIT_DELIMITER, name_table::flag, attr::flags, free_boolexp(), free_lbuf, free_mbuf, indiv_attraccess_nametab, LBUF_SIZE, name_table::name, attr::name, Name(), NOTHING, notify_printf(), olist_first(), olist_next(), olist_pop(), olist_push(), parse_attrib_wild(), parse_boolexp(), name_table::perm, Read_attr, StringCopy, strip_ansi_r(), and unparse_boolexp_decompile().
01262 { 01263 BOOLEXP *bool; 01264 char *got, *thingname, *as, *ltext, *buff, *s; 01265 dbref aowner, thing; 01266 int val, aflags, ca, atr; 01267 ATTR *attr; 01268 NAMETAB *np; 01269 char new[LBUF_SIZE]; 01270 01271 /* Check for obj/attr first */ 01272 01273 olist_push(); 01274 if(parse_attrib_wild(player, name, &thing, 0, 1, 0)) { 01275 buff = alloc_mbuf("do_decomp.attr_name"); 01276 thingname = alloc_lbuf("do_decomp"); 01277 if(key & DECOMP_DBREF) { 01278 sprintf(thingname, "%d", (int) thing); 01279 } else { 01280 StringCopy(thingname, Name(thing)); 01281 } 01282 strncpy(new, thingname, LBUF_SIZE-1); 01283 for(atr = olist_first(); atr != NOTHING; atr = olist_next()) { 01284 if((atr == A_NAME || atr == A_LOCK)) 01285 continue; 01286 attr = atr_num(atr); 01287 if(!attr) 01288 continue; 01289 01290 got = atr_get(thing, atr, &aowner, &aflags); 01291 if(Read_attr(player, thing, attr, aowner, aflags)) { 01292 if(attr->flags & AF_IS_LOCK) { 01293 bool = parse_boolexp(player, got, 1); 01294 ltext = unparse_boolexp_decompile(player, bool); 01295 free_boolexp(bool); 01296 notify_printf(player, "@lock/%s %s=%s", attr->name, 01297 strip_ansi_r(new,thingname,strlen(thingname)), ltext); 01298 } else { 01299 StringCopy(buff, attr->name); 01300 for(s = thingname; *s; s++) { 01301 if(*s == EXIT_DELIMITER) { 01302 *s = '\0'; 01303 break; 01304 } 01305 } 01306 notify_printf(player, "%c%s %s=%s", 01307 ((atr < A_USER_START) ? '@' : '&'), buff, 01308 strip_ansi_r(new,thingname,strlen(thingname)), got); 01309 01310 if(aflags & AF_LOCK) { 01311 notify_printf(player, "@lock %s/%s", 01312 strip_ansi_r(new,thingname,strlen(thingname)), buff); 01313 } 01314 01315 for(np = indiv_attraccess_nametab; np->name; np++) { 01316 01317 if((aflags & np->flag) && 01318 check_access(player, np->perm) && 01319 (!(np->perm & CA_NO_DECOMP))) { 01320 01321 notify_printf(player, "@set %s/%s = %s", 01322 strip_ansi_r(new,thingname,strlen(thingname)), buff, 01323 np->name); 01324 } 01325 } 01326 } 01327 } 01328 free_lbuf(got); 01329 } 01330 free_mbuf(buff); 01331 free_lbuf(thingname); 01332 olist_pop(); 01333 return; 01334 } 01335 olist_pop(); 01336 01337 init_match(player, name, TYPE_THING); 01338 match_everything(MAT_EXIT_PARENTS); 01339 thing = noisy_match_result(); 01340 01341 /* 01342 * get result 01343 */ 01344 if(thing == NOTHING) 01345 return; 01346 01347 if(!Examinable(player, thing)) { 01348 notify_quiet(player, 01349 "You can only decompile things you can examine."); 01350 return; 01351 } 01352 thingname = atr_get(thing, A_LOCK, &aowner, &aflags); 01353 bool = parse_boolexp(player, thingname, 1); 01354 01355 /* 01356 * Determine the name of the thing to use in reporting and then 01357 * report the command to make the thing. 01358 */ 01359 01360 if(qual && *qual) { 01361 StringCopy(thingname, qual); 01362 } else { 01363 switch (Typeof(thing)) { 01364 case TYPE_THING: 01365 StringCopy(thingname, Name(thing)); 01366 val = OBJECT_DEPOSIT(Pennies(thing)); 01367 notify_printf(player, "@create %s=%d", 01368 translate_string(thingname, 1), val); 01369 break; 01370 case TYPE_ROOM: 01371 StringCopy(thingname, "here"); 01372 notify_printf(player, "@dig/teleport %s", 01373 translate_string(Name(thing), 1)); 01374 break; 01375 case TYPE_EXIT: 01376 StringCopy(thingname, Name(thing)); 01377 notify_printf(player, "@open %s", 01378 translate_string(Name(thing), 1)); 01379 for(got = thingname; *got; got++) { 01380 if(*got == EXIT_DELIMITER) { 01381 *got = '\0'; 01382 break; 01383 } 01384 } 01385 break; 01386 case TYPE_PLAYER: 01387 StringCopy(thingname, "me"); 01388 break; 01389 } 01390 } 01391 01392 /* 01393 * Report the lock (if any) 01394 */ 01395 01396 strncpy(new, thingname, LBUF_SIZE-1); 01397 if(bool != TRUE_BOOLEXP) { 01398 notify_printf(player, "@lock %s=%s", strip_ansi_r(new,thingname,strlen(thingname)), 01399 unparse_boolexp_decompile(player, bool)); 01400 } 01401 free_boolexp(bool); 01402 01403 /* 01404 * Report attributes 01405 */ 01406 01407 buff = alloc_mbuf("do_decomp.attr_name"); 01408 for(ca = atr_head(thing, &as); ca; ca = atr_next(&as)) { 01409 if((ca == A_NAME) || (ca == A_LOCK)) 01410 continue; 01411 attr = atr_num(ca); 01412 if(!attr) 01413 continue; 01414 if((attr->flags & AF_NOCMD) && !(attr->flags & AF_IS_LOCK)) 01415 continue; 01416 01417 got = atr_get(thing, ca, &aowner, &aflags); 01418 if(Read_attr(player, thing, attr, aowner, aflags)) { 01419 if(attr->flags & AF_IS_LOCK) { 01420 bool = parse_boolexp(player, got, 1); 01421 ltext = unparse_boolexp_decompile(player, bool); 01422 free_boolexp(bool); 01423 notify_printf(player, "@lock/%s %s=%s", attr->name, 01424 thingname, ltext); 01425 } else { 01426 StringCopy(buff, attr->name); 01427 notify_printf(player, "%c%s %s=%s", 01428 ((ca < A_USER_START) ? '@' : '&'), buff, 01429 strip_ansi_r(new,thingname,strlen(thingname)), got); 01430 01431 if(aflags & AF_LOCK) { 01432 notify_printf(player, "@lock %s/%s", 01433 strip_ansi_r(new,thingname,strlen(thingname)), buff); 01434 } 01435 for(np = indiv_attraccess_nametab; np->name; np++) { 01436 01437 if((aflags & np->flag) && 01438 check_access(player, np->perm) && 01439 (!(np->perm & CA_NO_DECOMP))) { 01440 01441 notify_printf(player, "@set %s/%s = %s", 01442 strip_ansi_r(new,thingname,strlen(thingname)), buff, np->name); 01443 } 01444 } 01445 } 01446 } 01447 free_lbuf(got); 01448 } 01449 free_mbuf(buff); 01450 01451 decompile_flags(player, thing, thingname); 01452 decompile_powers(player, thing, thingname); 01453 01454 /* 01455 * If the object has a parent, report it 01456 */ 01457 01458 if(Parent(thing) != NOTHING) 01459 notify_printf(player, "@parent %s=#%d", strip_ansi_r(new,thingname,strlen(thingname)), 01460 Parent(thing)); 01461 01462 /* 01463 * If the object has a zone, report it 01464 */ 01465 if(Zone(thing) != NOTHING) 01466 notify_printf(player, "@chzone %s=#%d", strip_ansi_r(new,thingname,strlen(thingname)), 01467 Zone(thing)); 01468 01469 free_lbuf(thingname); 01470 }
Definition at line 956 of file look.c.
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_printf(), NOTYPE, Parent, parse_range(), payfor(), confdata::searchcost, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, and unparse_object().
00957 { 00958 dbref thing, i, j; 00959 char *exit, *message; 00960 int control_thing, count, low_bound, high_bound; 00961 FWDLIST *fp; 00962 00963 parse_range(&name, &low_bound, &high_bound); 00964 if(!name || !*name) { 00965 if(Has_location(player)) 00966 thing = Location(player); 00967 else 00968 thing = player; 00969 if(!Good_obj(thing)) 00970 return; 00971 } else { 00972 init_match(player, name, NOTYPE); 00973 match_everything(MAT_EXIT_PARENTS); 00974 thing = noisy_match_result(); 00975 if(!Good_obj(thing)) 00976 return; 00977 } 00978 00979 if(!payfor(player, mudconf.searchcost)) { 00980 notify_printf(player, "You don't have enough %s.", 00981 mudconf.many_coins); 00982 return; 00983 } 00984 message = alloc_lbuf("do_entrances"); 00985 control_thing = Examinable(player, thing); 00986 count = 0; 00987 for(i = low_bound; i <= high_bound; i++) { 00988 if(control_thing || Examinable(player, i)) { 00989 switch (Typeof(i)) { 00990 case TYPE_EXIT: 00991 if(Location(i) == thing) { 00992 exit = unparse_object(player, Exits(i), 0); 00993 notify_printf(player, "%s (%s)", exit, Name(i)); 00994 free_lbuf(exit); 00995 count++; 00996 } 00997 break; 00998 case TYPE_ROOM: 00999 if(Dropto(i) == thing) { 01000 exit = unparse_object(player, i, 0); 01001 notify_printf(player, "%s [dropto]", exit); 01002 free_lbuf(exit); 01003 count++; 01004 } 01005 break; 01006 case TYPE_THING: 01007 case TYPE_PLAYER: 01008 if(Home(i) == thing) { 01009 exit = unparse_object(player, i, 0); 01010 notify_printf(player, "%s [home]", exit); 01011 free_lbuf(exit); 01012 count++; 01013 } 01014 break; 01015 } 01016 01017 /* 01018 * Check for parents 01019 */ 01020 01021 if(Parent(i) == thing) { 01022 exit = unparse_object(player, i, 0); 01023 notify_printf(player, "%s [parent]", exit); 01024 free_lbuf(exit); 01025 count++; 01026 } 01027 /* 01028 * Check for forwarding 01029 */ 01030 01031 if(H_Fwdlist(i)) { 01032 fp = fwdlist_get(i); 01033 if(!fp) 01034 continue; 01035 for(j = 0; j < fp->count; j++) { 01036 if(fp->data[j] != thing) 01037 continue; 01038 exit = unparse_object(player, i, 0); 01039 notify_printf(player, "%s [forward]", exit); 01040 free_lbuf(exit); 01041 count++; 01042 } 01043 } 01044 } 01045 } 01046 free_lbuf(message); 01047 notify_printf(player, "%d entrance%s found.", count, 01048 (count == 1) ? "" : "s"); 01049 }
Definition at line 641 of file look.c.
References A_DESC, A_LOCK, alloc_lbuf, atr_get(), atr_get_str(), atr_num(), Contents, CONTENTS_REMOTE, debug_examine(), do_parent(), 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, Home, init_match(), Link_exit, Linkable, loc, Location, look_atrs(), look_contents(), look_exits(), confdata::many_coins, MAT_EXIT_PARENTS, match_everything(), mudconf, Name(), nearby(), noisy_match_result(), NOTHING, notify, notify_printf(), notify_quiet, NOTYPE, olist_pop(), olist_push(), Opaque, Owner, Parent, parse_attrib_wild(), parse_boolexp(), Pennies(), power_description(), confdata::read_rem_desc, confdata::read_rem_name, show_desc(), StringCopy, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, unparse_boolexp(), unparse_object(), view_atr(), and Zone.
00642 { 00643 dbref thing, content, exit, aowner, loc; 00644 char savec; 00645 char *temp, *buf, *buf2; 00646 BOOLEXP *bool; 00647 int control, aflags, do_parent; 00648 00649 /* 00650 * This command is pointless if the player can't hear. 00651 */ 00652 00653 if(!Hearer(player)) 00654 return; 00655 00656 do_parent = key & EXAM_PARENT; 00657 thing = NOTHING; 00658 if(!name || !*name) { 00659 if((thing = Location(player)) == NOTHING) 00660 return; 00661 } else { 00662 00663 /* Check for obj/attr first */ 00664 00665 olist_push(); 00666 if(parse_attrib_wild(player, name, &thing, do_parent, 1, 0)) { 00667 exam_wildattrs(player, thing, do_parent); 00668 olist_pop(); 00669 return; 00670 } 00671 olist_pop(); 00672 00673 /* Look it up */ 00674 00675 init_match(player, name, NOTYPE); 00676 match_everything(MAT_EXIT_PARENTS); 00677 thing = noisy_match_result(); 00678 if(!Good_obj(thing)) 00679 return; 00680 } 00681 00682 /* 00683 * Check for the /debug switch 00684 */ 00685 00686 if(key == EXAM_DEBUG) { 00687 if(!Examinable(player, thing)) { 00688 notify_quiet(player, "Permission denied."); 00689 } else { 00690 debug_examine(player, thing); 00691 } 00692 return; 00693 } 00694 control = (Examinable(player, thing) || Link_exit(player, thing)); 00695 00696 if(control) { 00697 buf2 = unparse_object(player, thing, 0); 00698 notify(player, buf2); 00699 free_lbuf(buf2); 00700 if(mudconf.ex_flags) { 00701 buf2 = flag_description(player, thing); 00702 notify(player, buf2); 00703 free_mbuf(buf2); 00704 } 00705 } else { 00706 if((key == EXAM_DEFAULT) && !mudconf.exam_public) { 00707 if(mudconf.read_rem_name) { 00708 buf2 = alloc_lbuf("do_examine.pub_name"); 00709 StringCopy(buf2, Name(thing)); 00710 notify_printf(player, "%s is owned by %s", buf2, 00711 Name(Owner(thing))); 00712 free_lbuf(buf2); 00713 } else { 00714 notify_printf(player, "Owned by %s", Name(Owner(thing))); 00715 } 00716 return; 00717 } 00718 } 00719 00720 temp = alloc_lbuf("do_examine.info"); 00721 00722 if(control || mudconf.read_rem_desc || nearby(player, thing)) { 00723 temp = atr_get_str(temp, thing, A_DESC, &aowner, &aflags); 00724 if(*temp) { 00725 if(Examinable(player, thing) || (aowner == Owner(player))) { 00726 view_atr(player, thing, atr_num(A_DESC), temp, aowner, 00727 aflags, 1); 00728 } else { 00729 show_desc(player, thing, 0); 00730 } 00731 } 00732 } else { 00733 notify(player, "<Too far away to get a good look>"); 00734 } 00735 00736 if(control) { 00737 00738 /* 00739 * print owner, key, and value 00740 */ 00741 00742 savec = mudconf.many_coins[0]; 00743 mudconf.many_coins[0] = (islower(savec) ? toupper(savec) : savec); 00744 buf2 = atr_get(thing, A_LOCK, &aowner, &aflags); 00745 bool = parse_boolexp(player, buf2, 1); 00746 buf = unparse_boolexp(player, bool); 00747 free_boolexp(bool); 00748 StringCopy(buf2, Name(Owner(thing))); 00749 notify_printf(player, "Owner: %s Key: %s %s: %d", buf2, buf, 00750 mudconf.many_coins, Pennies(thing)); 00751 free_lbuf(buf2); 00752 mudconf.many_coins[0] = savec; 00753 00754 if(mudconf.have_zones) { 00755 buf2 = unparse_object(player, Zone(thing), 0); 00756 notify_printf(player, "Zone: %s", buf2); 00757 free_lbuf(buf2); 00758 } 00759 /* 00760 * print parent 00761 */ 00762 00763 loc = Parent(thing); 00764 if(loc != NOTHING) { 00765 buf2 = unparse_object(player, loc, 0); 00766 notify_printf(player, "Parent: %s", buf2); 00767 free_lbuf(buf2); 00768 } 00769 buf2 = power_description(player, thing); 00770 notify(player, buf2); 00771 free_mbuf(buf2); 00772 00773 } 00774 if(key != EXAM_BRIEF) 00775 look_atrs(player, thing, do_parent); 00776 00777 /* 00778 * show him interesting stuff 00779 */ 00780 00781 if(control) { 00782 00783 /* 00784 * Contents 00785 */ 00786 00787 if(Contents(thing) != NOTHING) { 00788 notify(player, "Contents:"); 00789 DOLIST(content, Contents(thing)) { 00790 buf2 = unparse_object(player, content, 0); 00791 notify(player, buf2); 00792 free_lbuf(buf2); 00793 } 00794 } 00795 /* 00796 * Show stuff that depends on the object type 00797 */ 00798 00799 switch (Typeof(thing)) { 00800 case TYPE_ROOM: 00801 00802 /* 00803 * tell him about exits 00804 */ 00805 00806 if(Exits(thing) != NOTHING) { 00807 notify(player, "Exits:"); 00808 DOLIST(exit, Exits(thing)) { 00809 buf2 = unparse_object(player, exit, 0); 00810 notify(player, buf2); 00811 free_lbuf(buf2); 00812 } 00813 } else { 00814 notify(player, "No exits."); 00815 } 00816 00817 /* 00818 * print dropto if present 00819 */ 00820 00821 if(Dropto(thing) != NOTHING) { 00822 buf2 = unparse_object(player, Dropto(thing), 0); 00823 notify_printf(player, "Dropped objects go to: %s", buf2); 00824 free_lbuf(buf2); 00825 } 00826 break; 00827 case TYPE_THING: 00828 case TYPE_PLAYER: 00829 00830 /* 00831 * tell him about exits 00832 */ 00833 00834 if(Exits(thing) != NOTHING) { 00835 notify(player, "Exits:"); 00836 DOLIST(exit, Exits(thing)) { 00837 buf2 = unparse_object(player, exit, 0); 00838 notify(player, buf2); 00839 free_lbuf(buf2); 00840 } 00841 } else { 00842 notify(player, "No exits."); 00843 } 00844 00845 /* 00846 * print home 00847 */ 00848 00849 loc = Home(thing); 00850 buf2 = unparse_object(player, loc, 0); 00851 notify_printf(player, "Home: %s", buf2); 00852 free_lbuf(buf2); 00853 00854 /* 00855 * print location if player can link to it 00856 */ 00857 00858 loc = Location(thing); 00859 if((Location(thing) != NOTHING) && (Examinable(player, loc) || 00860 Examinable(player, thing) 00861 || Linkable(player, loc))) { 00862 buf2 = unparse_object(player, loc, 0); 00863 notify_printf(player, "Location: %s", buf2); 00864 free_lbuf(buf2); 00865 } 00866 break; 00867 case TYPE_EXIT: 00868 buf2 = unparse_object(player, Exits(thing), 0); 00869 notify_printf(player, "Source: %s", buf2); 00870 free_lbuf(buf2); 00871 00872 /* 00873 * print destination 00874 */ 00875 00876 switch (Location(thing)) { 00877 case NOTHING: 00878 break; 00879 case HOME: 00880 notify(player, "Destination: *HOME*"); 00881 break; 00882 default: 00883 buf2 = unparse_object(player, Location(thing), 0); 00884 notify_printf(player, "Destination: %s", buf2); 00885 free_lbuf(buf2); 00886 break; 00887 } 00888 break; 00889 default: 00890 break; 00891 } 00892 } else if(!Opaque(thing) && nearby(player, thing)) { 00893 if(Has_contents(thing)) 00894 look_contents(player, thing, "Contents:", CONTENTS_REMOTE); 00895 if(Typeof(thing) != TYPE_EXIT) 00896 look_exits(player, thing, "Obvious exits:"); 00897 } 00898 free_lbuf(temp); 00899 00900 if(!control) { 00901 if(mudconf.read_rem_name) { 00902 buf2 = alloc_lbuf("do_examine.pub_name"); 00903 StringCopy(buf2, Name(thing)); 00904 notify_printf(player, "%s is owned by %s", buf2, 00905 Name(Owner(thing))); 00906 free_lbuf(buf2); 00907 } else { 00908 notify_printf(player, "Owned by %s", Name(Owner(thing))); 00909 } 00910 } 00911 }
Definition at line 920 of file look.c.
References alloc_lbuf, Contents, do_score(), DOLIST, Exits, free_lbuf, Name(), NOTHING, notify, safe_chr, safe_str, and unparse_object().
00921 { 00922 dbref thing; 00923 char *buff, *s, *e; 00924 00925 thing = Contents(player); 00926 if(thing == NOTHING) { 00927 notify(player, "You aren't carrying anything."); 00928 } else { 00929 notify(player, "You are carrying:"); 00930 DOLIST(thing, thing) { 00931 buff = unparse_object(player, thing, 1); 00932 notify(player, buff); 00933 free_lbuf(buff); 00934 } 00935 } 00936 00937 thing = Exits(player); 00938 if(thing != NOTHING) { 00939 notify(player, "Exits:"); 00940 e = buff = alloc_lbuf("look_exits"); 00941 DOLIST(thing, thing) { 00942 /* 00943 * chop off first exit alias to display 00944 */ 00945 for(s = Name(thing); *s && (*s != ';'); s++) 00946 safe_chr(*s, buff, &e); 00947 safe_str((char *) " ", buff, &e); 00948 } 00949 *e = 0; 00950 notify(player, buff); 00951 free_lbuf(buff); 00952 } 00953 do_score(player, player, 0); 00954 }
Definition at line 424 of file look.c.
References CONTENTS_NESTED, Good_obj, init_match(), LK_OBEYTERSE, LK_SHOWATTR, LK_SHOWEXIT, loc, Location, Long_Fingers, look_contents(), look_in(), LOOK_OUTSIDE, look_simple(), match_absolute(), match_exit_with_parents(), match_here(), match_master_exit(), match_me(), match_neighbor(), match_player(), match_possessed(), match_possession(), match_result(), match_status(), mudconf, NOTHING, notify_quiet, NOTYPE, Opaque, Terse, confdata::terse_contents, confdata::terse_look, Transparent, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.
00425 { 00426 dbref thing, loc, look_key; 00427 00428 look_key = LK_SHOWATTR | LK_SHOWEXIT; 00429 if(!mudconf.terse_look) 00430 look_key |= LK_OBEYTERSE; 00431 00432 loc = Location(player); 00433 if(!name || !*name) { 00434 thing = loc; 00435 if(Good_obj(thing)) { 00436 if(key & LOOK_OUTSIDE) { 00437 if((Typeof(thing) == TYPE_ROOM) || Opaque(thing)) { 00438 notify_quiet(player, "You can't look outside."); 00439 return; 00440 } 00441 thing = Location(thing); 00442 } 00443 look_in(player, thing, look_key); 00444 } 00445 return; 00446 } 00447 /* 00448 * Look for the target locally 00449 */ 00450 00451 thing = (key & LOOK_OUTSIDE) ? loc : player; 00452 init_match(thing, name, NOTYPE); 00453 match_exit_with_parents(); 00454 match_neighbor(); 00455 match_possession(); 00456 if(Long_Fingers(player)) { 00457 match_absolute(); 00458 match_player(); 00459 } 00460 match_here(); 00461 match_me(); 00462 match_master_exit(); 00463 thing = match_result(); 00464 00465 /* 00466 * Not found locally, check possessive 00467 */ 00468 00469 if(!Good_obj(thing)) { 00470 thing = 00471 match_status(player, match_possessed(player, 00472 ((key & LOOK_OUTSIDE) ? loc : 00473 player), (char *) name, 00474 thing, 0)); 00475 } 00476 /* 00477 * If we found something, go handle it 00478 */ 00479 00480 if(Good_obj(thing)) { 00481 switch (Typeof(thing)) { 00482 case TYPE_ROOM: 00483 look_in(player, thing, look_key); 00484 break; 00485 case TYPE_THING: 00486 case TYPE_PLAYER: 00487 look_simple(player, thing, !mudconf.terse_look); 00488 if(!Opaque(thing) && (!Terse(player) || mudconf.terse_contents)) { 00489 look_contents(player, thing, "Carrying:", CONTENTS_NESTED); 00490 } 00491 break; 00492 case TYPE_EXIT: 00493 look_simple(player, thing, !mudconf.terse_look); 00494 if(Transparent(thing) && (Location(thing) != NOTHING)) { 00495 look_key &= ~LK_SHOWATTR; 00496 look_in(player, Location(thing), look_key); 00497 } 00498 break; 00499 default: 00500 look_simple(player, thing, !mudconf.terse_look); 00501 } 00502 } 00503 }
Definition at line 913 of file look.c.
References confdata::many_coins, mudconf, notify_printf(), confdata::one_coin, and Pennies().
Referenced by do_inventory().
00914 { 00915 notify_printf(player, "You have %d %s.", Pennies(player), 00916 (Pennies(player) == 00917 1) ? mudconf.one_coin : mudconf.many_coins); 00918 }
Definition at line 1176 of file look.c.
References Contents, Dark, Examinable, Exits, Good_obj, Has_contents, Has_exits, Has_location, Location, match_controlled(), mudconf, Next, NOTHING, notify, notify_quiet, sweep_check(), SWEEP_COMMANDS, SWEEP_CONNECT, confdata::sweep_dark, SWEEP_EXITS, SWEEP_HERE, SWEEP_LISTEN, SWEEP_ME, SWEEP_PLAYER, and SWEEP_VERBOSE.
01177 { 01178 dbref here, sweeploc; 01179 int where_key, what_key; 01180 01181 where_key = key & (SWEEP_ME | SWEEP_HERE | SWEEP_EXITS); 01182 what_key = 01183 key & (SWEEP_COMMANDS | SWEEP_LISTEN | SWEEP_PLAYER | SWEEP_CONNECT); 01184 01185 if(where && *where) { 01186 sweeploc = match_controlled(player, where); 01187 if(!Good_obj(sweeploc)) 01188 return; 01189 } else { 01190 sweeploc = player; 01191 } 01192 01193 if(!where_key) 01194 where_key = -1; 01195 if(!what_key) 01196 what_key = -1; 01197 else if(what_key == SWEEP_VERBOSE) 01198 what_key = SWEEP_VERBOSE | SWEEP_COMMANDS; 01199 01200 /* 01201 * Check my location. If I have none or it is dark, check just me. 01202 */ 01203 01204 if(where_key & SWEEP_HERE) { 01205 notify(player, "Sweeping location..."); 01206 if(Has_location(sweeploc)) { 01207 here = Location(sweeploc); 01208 if((here == NOTHING) || (Dark(here) && !mudconf.sweep_dark && 01209 !Examinable(player, here))) { 01210 notify_quiet(player, 01211 "Sorry, it is dark here and you can't search for bugs"); 01212 sweep_check(player, sweeploc, what_key, 0); 01213 } else { 01214 sweep_check(player, here, what_key, 1); 01215 for(here = Contents(here); here != NOTHING; here = Next(here)) 01216 sweep_check(player, here, what_key, 0); 01217 } 01218 } else { 01219 sweep_check(player, sweeploc, what_key, 0); 01220 } 01221 } 01222 /* 01223 * Check exits in my location 01224 */ 01225 01226 if((where_key & SWEEP_EXITS) && Has_location(sweeploc)) { 01227 notify(player, "Sweeping exits..."); 01228 for(here = Exits(Location(sweeploc)); here != NOTHING; 01229 here = Next(here)) 01230 sweep_check(player, here, what_key, 0); 01231 } 01232 /* 01233 * Check my inventory 01234 */ 01235 01236 if((where_key & SWEEP_ME) && Has_contents(sweeploc)) { 01237 notify(player, "Sweeping inventory..."); 01238 for(here = Contents(sweeploc); here != NOTHING; here = Next(here)) 01239 sweep_check(player, here, what_key, 0); 01240 } 01241 /* 01242 * Check carried exits 01243 */ 01244 01245 if((where_key & SWEEP_EXITS) && Has_exits(sweeploc)) { 01246 notify(player, "Sweeping carried exits..."); 01247 for(here = Exits(sweeploc); here != NOTHING; here = Next(here)) 01248 sweep_check(player, here, what_key, 0); 01249 } 01250 notify(player, "Sweep complete."); 01251 }
Definition at line 576 of file look.c.
References A_DESC, AF_PRIVATE, atr_get(), atr_num(), atr_pget(), Examinable, attr::flags, free_lbuf, mudconf, nearby(), NOTHING, notify, notify_quiet, olist_first(), olist_next(), Owner, Read_attr, confdata::read_rem_desc, show_desc(), TYPE_PLAYER, Typeof, and view_atr().
Referenced by do_examine().
00577 { 00578 int atr, aflags, got_any; 00579 char *buf; 00580 dbref aowner; 00581 ATTR *ap; 00582 00583 got_any = 0; 00584 for(atr = olist_first(); atr != NOTHING; atr = olist_next()) { 00585 ap = atr_num(atr); 00586 if(!ap) 00587 continue; 00588 00589 if(do_parent && !(ap->flags & AF_PRIVATE)) 00590 buf = atr_pget(thing, atr, &aowner, &aflags); 00591 else 00592 buf = atr_get(thing, atr, &aowner, &aflags); 00593 00594 /* 00595 * Decide if the player should see the attr: * If obj is * * 00596 * * Examinable and has rights to see, yes. * If a player and 00597 * * * * * has rights to see, yes... * except if faraway, 00598 * * * * attr=DESC, and * remote DESC-reading is not turned 00599 * on. * * * * * * If I own the attrib and have rights to 00600 * see, yes... * * * * except if faraway, attr=DESC, and * 00601 * remote * DESC-reading * * is not turned on. 00602 */ 00603 00604 if(Examinable(player, thing) && 00605 Read_attr(player, thing, ap, aowner, aflags)) { 00606 got_any = 1; 00607 view_atr(player, thing, ap, buf, aowner, aflags, 0); 00608 } else if((Typeof(thing) == TYPE_PLAYER) && 00609 Read_attr(player, thing, ap, aowner, aflags)) { 00610 got_any = 1; 00611 if(aowner == Owner(player)) { 00612 view_atr(player, thing, ap, buf, aowner, aflags, 0); 00613 } else if((atr == A_DESC) && (mudconf.read_rem_desc || 00614 nearby(player, thing))) { 00615 show_desc(player, thing, 0); 00616 } else if(atr != A_DESC) { 00617 view_atr(player, thing, ap, buf, aowner, aflags, 0); 00618 } else { 00619 notify(player, "<Too far away to get a good look>"); 00620 } 00621 } else if(Read_attr(player, thing, ap, aowner, aflags)) { 00622 got_any = 1; 00623 if(aowner == Owner(player)) { 00624 view_atr(player, thing, ap, buf, aowner, aflags, 0); 00625 } else if((atr == A_DESC) && (mudconf.read_rem_desc || 00626 nearby(player, thing))) { 00627 show_desc(player, thing, 0); 00628 } else if(nearby(player, thing)) { 00629 view_atr(player, thing, ap, buf, aowner, aflags, 0); 00630 } else { 00631 notify(player, "<Too far away to get a good look>"); 00632 } 00633 } 00634 free_lbuf(buf); 00635 } 00636 if(!got_any) 00637 notify_quiet(player, "No matching attributes found."); 00638 00639 }
Definition at line 264 of file look.c.
References Good_obj, ITER_PARENTS, look_atrs1(), mudstate, nhashflush(), Parent, and statedata::parent_htab.
Referenced by do_examine(), look_in(), and look_simple().
00265 { 00266 dbref parent; 00267 int lev, check_exclude, hash_insert; 00268 00269 if(!check_parents) { 00270 look_atrs1(player, thing, thing, 0, 0); 00271 } else { 00272 hash_insert = 1; 00273 check_exclude = 0; 00274 nhashflush(&mudstate.parent_htab, 0); 00275 ITER_PARENTS(thing, parent, lev) { 00276 if(!Good_obj(Parent(parent))) 00277 hash_insert = 0; 00278 look_atrs1(player, parent, thing, check_exclude, hash_insert); 00279 check_exclude = 1; 00280 } 00281 } 00282 }
static void look_atrs1 | ( | dbref | player, | |
dbref | thing, | |||
dbref | othing, | |||
int | check_exclude, | |||
int | hash_insert | |||
) | [static] |
Definition at line 220 of file look.c.
References A_DESC, A_LOCK, AF_PRIVATE, atr_get(), atr_head(), atr_next(), atr_num(), attr, free_lbuf, mudstate, nhashadd(), nhashfind(), statedata::parent_htab, Read_attr, and view_atr().
Referenced by look_atrs().
00222 { 00223 dbref aowner; 00224 int ca, aflags; 00225 ATTR *attr, *cattr; 00226 char *as, *buf; 00227 00228 cattr = (ATTR *) malloc(sizeof(ATTR)); 00229 for(ca = atr_head(thing, &as); ca; ca = atr_next(&as)) { 00230 if((ca == A_DESC) || (ca == A_LOCK)) 00231 continue; 00232 attr = atr_num(ca); 00233 if(!attr) 00234 continue; 00235 00236 bcopy((char *) attr, (char *) cattr, sizeof(ATTR)); 00237 00238 /* 00239 * Should we exclude this attr? 00240 */ 00241 00242 if(check_exclude && ((attr->flags & AF_PRIVATE) || 00243 nhashfind(ca, &mudstate.parent_htab))) 00244 continue; 00245 00246 buf = atr_get(thing, ca, &aowner, &aflags); 00247 if(Read_attr(player, othing, attr, aowner, aflags)) { 00248 /* check_zone/atr_num overwrites attr!! */ 00249 00250 if(attr->number != cattr->number) 00251 bcopy((char *) cattr, (char *) attr, sizeof(ATTR)); 00252 00253 if(!(check_exclude && (aflags & AF_PRIVATE))) { 00254 if(hash_insert) 00255 nhashadd(ca, (int *) attr, &mudstate.parent_htab); 00256 view_atr(player, thing, attr, buf, aowner, aflags, 0); 00257 } 00258 } 00259 free_lbuf(buf); 00260 } 00261 free(cattr); 00262 }
static void look_contents | ( | dbref | player, | |
dbref | loc, | |||
const char * | contents_name, | |||
int | style | |||
) | [static] |
Definition at line 120 of file look.c.
References can_see(), Contents, Dark, DOLIST, Examinable, free_lbuf, mudconf, notify, confdata::see_own_dark, and unparse_object().
Referenced by do_examine(), do_look(), and look_in().
00122 { 00123 dbref thing; 00124 dbref can_see_loc; 00125 char *buff; 00126 char remote_num[32]; 00127 00128 /* 00129 * check to see if he can see the location 00130 */ 00131 00132 can_see_loc = (!Dark(loc) || (mudconf.see_own_dark && 00133 Examinable(player, loc))); 00134 00135 /* 00136 * check to see if there is anything there 00137 */ 00138 00139 DOLIST(thing, Contents(loc)) { 00140 if(can_see(player, thing, can_see_loc)) { 00141 00142 /* 00143 * something exists! show him everything 00144 */ 00145 00146 notify(player, contents_name); 00147 DOLIST(thing, Contents(loc)) { 00148 if(can_see(player, thing, can_see_loc)) { 00149 buff = unparse_object(player, thing, 1); 00150 notify(player, buff); 00151 free_lbuf(buff); 00152 00153 } 00154 } 00155 break; /* 00156 * we're done 00157 */ 00158 } 00159 } 00160 }
Definition at line 23 of file look.c.
References alloc_lbuf, Dark, DOLIST, exit_displayable(), Exits, free_lbuf, Good_obj, Has_exits, ITER_PARENTS, Location, Name(), notify, notify_printf(), safe_chr, safe_str, StringCopy, Transparent, VE_BASE_DARK, and VE_LOC_DARK.
Referenced by do_examine(), and look_in().
00024 { 00025 dbref thing, parent; 00026 char *buff, *e, *s, *buff1, *e1; 00027 int foundany, lev, key; 00028 00029 /* 00030 * make sure location has exits 00031 */ 00032 00033 if(!Good_obj(loc) || !Has_exits(loc)) 00034 return; 00035 00036 /* 00037 * make sure there is at least one visible exit 00038 */ 00039 00040 foundany = 0; 00041 key = 0; 00042 if(Dark(loc)) 00043 key |= VE_BASE_DARK; 00044 ITER_PARENTS(loc, parent, lev) { 00045 key &= ~VE_LOC_DARK; 00046 if(Dark(parent)) 00047 key |= VE_LOC_DARK; 00048 DOLIST(thing, Exits(parent)) { 00049 if(exit_displayable(thing, player, key)) { 00050 foundany = 1; 00051 break; 00052 } 00053 } 00054 if(foundany) 00055 break; 00056 } 00057 00058 if(!foundany) 00059 return; 00060 /* 00061 * Display the list of exit names 00062 */ 00063 00064 notify(player, exit_name); 00065 e = buff = alloc_lbuf("look_exits"); 00066 e1 = buff1 = alloc_lbuf("look_exits2"); 00067 ITER_PARENTS(loc, parent, lev) { 00068 key &= ~VE_LOC_DARK; 00069 if(Dark(parent)) 00070 key |= VE_LOC_DARK; 00071 if(Transparent(loc)) { 00072 DOLIST(thing, Exits(parent)) { 00073 if(exit_displayable(thing, player, key)) { 00074 StringCopy(buff, Name(thing)); 00075 for(e = buff; *e && (*e != ';'); e++); 00076 *e = '\0'; 00077 notify_printf(player, "%s leads to %s.", buff, 00078 Name(Location(thing))); 00079 } 00080 } 00081 } else { 00082 DOLIST(thing, Exits(parent)) { 00083 if(exit_displayable(thing, player, key)) { 00084 e1 = buff1; 00085 /* Put the exit name in buff1 */ 00086 /* 00087 * chop off first * * 00088 * 00089 * * exit alias to * 00090 * * * display 00091 */ 00092 00093 if(buff != e) 00094 safe_str((char *) " ", buff, &e); 00095 for(s = Name(thing); *s && (*s != ';'); s++) 00096 safe_chr(*s, buff1, &e1); 00097 *e1 = 0; 00098 /* Copy the exit name into 'buff' */ 00099 /* Append this exit to the list */ 00100 safe_str(buff1, buff, &e); 00101 00102 } 00103 } 00104 } 00105 } 00106 00107 if(!(Transparent(loc))) { 00108 safe_str((char *) "\r\n", buff, &e); 00109 *e = 0; 00110 notify(player, buff); 00111 } 00112 free_lbuf(buff); 00113 free_lbuf(buff1); 00114 }
Definition at line 353 of file look.c.
References A_AFAIL, A_ASUCC, A_FAIL, A_LOCK, A_OFAIL, A_OSUCC, A_SUCC, CONTENTS_LOCAL, could_doit(), did_it(), free_lbuf, Good_obj, Hearer(), LK_IDESC, LK_OBEYTERSE, LK_SHOWATTR, LK_SHOWEXIT, Location, look_atrs(), look_contents(), look_exits(), mudconf, notify, confdata::quiet_look, show_desc(), Terse, confdata::terse_contents, confdata::terse_exits, TYPE_ROOM, Typeof, and unparse_object().
Referenced by announce_connect(), do_look(), and move_object().
00354 { 00355 int pattr, oattr, aattr, is_terse, showkey; 00356 char *buff; 00357 00358 is_terse = (key & LK_OBEYTERSE) ? Terse(player) : 0; 00359 00360 /* 00361 * Only makes sense for things that can hear 00362 */ 00363 00364 if(!Hearer(player)) 00365 return; 00366 00367 /* 00368 * tell him the name, and the number if he can link to it 00369 */ 00370 00371 buff = unparse_object(player, loc, 1); 00372 notify(player, buff); 00373 free_lbuf(buff); 00374 00375 if(!Good_obj(loc)) 00376 return; /* 00377 * If we went to NOTHING et al, skip the * * 00378 * 00379 * * rest 00380 */ 00381 00382 /* 00383 * tell him the description 00384 */ 00385 00386 showkey = 0; 00387 if(loc == Location(player)) 00388 showkey |= LK_IDESC; 00389 if(key & LK_OBEYTERSE) 00390 showkey |= LK_OBEYTERSE; 00391 show_desc(player, loc, showkey); 00392 00393 /* 00394 * tell him the appropriate messages if he has the key 00395 */ 00396 00397 if(Typeof(loc) == TYPE_ROOM) { 00398 if(could_doit(player, loc, A_LOCK)) { 00399 pattr = A_SUCC; 00400 oattr = A_OSUCC; 00401 aattr = A_ASUCC; 00402 } else { 00403 pattr = A_FAIL; 00404 oattr = A_OFAIL; 00405 aattr = A_AFAIL; 00406 } 00407 if(is_terse) 00408 pattr = 0; 00409 did_it(player, loc, pattr, NULL, oattr, NULL, aattr, 00410 (char **) NULL, 0); 00411 } 00412 /* 00413 * tell him the attributes, contents and exits 00414 */ 00415 00416 if((key & LK_SHOWATTR) && !mudconf.quiet_look && !is_terse) 00417 look_atrs(player, loc, 0); 00418 if(!is_terse || mudconf.terse_contents) 00419 look_contents(player, loc, "Contents:", CONTENTS_LOCAL); 00420 if((key & LK_SHOWEXIT) && (!is_terse || mudconf.terse_exits)) 00421 look_exits(player, loc, "Obvious exits:"); 00422 }
Definition at line 284 of file look.c.
References A_ADESC, A_DESC, A_ODESC, did_it(), Examinable, free_lbuf, Hearer(), look_atrs(), mudconf, notify, confdata::quiet_look, Terse, confdata::terse_look, and unparse_object().
Referenced by do_look().
00285 { 00286 int pattr; 00287 char *buff; 00288 00289 /* 00290 * Only makes sense for things that can hear 00291 */ 00292 00293 if(!Hearer(player)) 00294 return; 00295 00296 /* 00297 * Get the name and db-number if we can examine it. 00298 */ 00299 00300 if(Examinable(player, thing)) { 00301 buff = unparse_object(player, thing, 1); 00302 notify(player, buff); 00303 free_lbuf(buff); 00304 00305 } 00306 pattr = (obey_terse && Terse(player)) ? 0 : A_DESC; 00307 did_it(player, thing, pattr, "You see nothing special.", A_ODESC, NULL, 00308 A_ADESC, (char **) NULL, 0); 00309 00310 if(!mudconf.quiet_look && (!Terse(player) || mudconf.terse_look)) { 00311 look_atrs(player, thing, 0); 00312 } 00313 }
Definition at line 315 of file look.c.
References A_ADESC, A_DESC, A_ODESC, atr_get_raw(), did_it(), confdata::indent_desc, isRoom, mudconf, and raw_notify_newline().
Referenced by show_desc().
00316 { 00317 char *got2; 00318 dbref aowner; 00319 int aflags, indent = 0; 00320 00321 indent = (isRoom(loc) && mudconf.indent_desc && atr_get_raw(loc, A_DESC)); 00322 00323 if(indent) 00324 raw_notify_newline(player); 00325 did_it(player, loc, A_DESC, NULL, A_ODESC, NULL, A_ADESC, 00326 (char **) NULL, 0); 00327 if(indent) 00328 raw_notify_newline(player); 00329 00330 }
Definition at line 332 of file look.c.
References A_ADESC, A_IDESC, A_ODESC, atr_pget(), did_it(), free_lbuf, LK_IDESC, LK_OBEYTERSE, show_a_desc(), Terse, TYPE_ROOM, and Typeof.
Referenced by do_examine(), exam_wildattrs(), and look_in().
00333 { 00334 char *got; 00335 dbref aowner; 00336 int aflags; 00337 00338 if((key & LK_OBEYTERSE) && Terse(player)) 00339 did_it(player, loc, 0, NULL, A_ODESC, NULL, A_ADESC, 00340 (char **) NULL, 0); 00341 else if((Typeof(loc) != TYPE_ROOM) && (key & LK_IDESC)) { 00342 if(*(got = atr_pget(loc, A_IDESC, &aowner, &aflags))) 00343 did_it(player, loc, A_IDESC, NULL, A_ODESC, NULL, A_ADESC, 00344 (char **) NULL, 0); 00345 else 00346 show_a_desc(player, loc); 00347 free_lbuf(got); 00348 } else { 00349 show_a_desc(player, loc); 00350 } 00351 }
Definition at line 1055 of file look.c.
References A_LISTEN, AF_NOPROG, alloc_lbuf, AMATCH_LISTEN, atr_get_str(), atr_head(), atr_next(), atr_num(), Audible, Commer(), Connected, Dark, attr::flags, free_lbuf, ITER_PARENTS, Monitor, mudconf, Name(), notify_printf(), Owner, confdata::player_listen, Puppet, safe_str, StringCopy, SWEEP_COMMANDS, SWEEP_CONNECT, confdata::sweep_dark, SWEEP_LISTEN, SWEEP_PLAYER, TYPE_EXIT, TYPE_PLAYER, Typeof, and WizRoy.
Referenced by do_sweep().
01056 { 01057 dbref aowner, parent; 01058 int canhear, cancom, isplayer, ispuppet, isconnected, attr, aflags; 01059 int is_parent, lev; 01060 char *buf, *buf2, *bp, *as, *buff, *s; 01061 ATTR *ap; 01062 01063 if(Dark(what) && !WizRoy(player) && !mudconf.sweep_dark) 01064 return; 01065 canhear = 0; 01066 cancom = 0; 01067 isplayer = 0; 01068 ispuppet = 0; 01069 isconnected = 0; 01070 is_parent = 0; 01071 01072 if((key & SWEEP_LISTEN) && (((Typeof(what) == TYPE_EXIT) || is_loc) && 01073 Audible(what))) { 01074 canhear = 1; 01075 } else if(key & SWEEP_LISTEN) { 01076 if(Monitor(what)) 01077 buff = alloc_lbuf("Hearer"); 01078 else 01079 buff = NULL; 01080 01081 for(attr = atr_head(what, &as); attr; attr = atr_next(&as)) { 01082 if(attr == A_LISTEN) { 01083 canhear = 1; 01084 break; 01085 } 01086 if(Monitor(what)) { 01087 ap = atr_num(attr); 01088 if(!ap || (ap->flags & AF_NOPROG)) 01089 continue; 01090 01091 atr_get_str(buff, what, attr, &aowner, &aflags); 01092 01093 /* 01094 * Make sure we can execute it 01095 */ 01096 01097 if((buff[0] != AMATCH_LISTEN) || (aflags & AF_NOPROG)) 01098 continue; 01099 01100 /* 01101 * Make sure there's a : in it 01102 */ 01103 01104 for(s = buff + 1; *s && (*s != ':'); s++); 01105 if(s) { 01106 canhear = 1; 01107 break; 01108 } 01109 } 01110 } 01111 if(buff) 01112 free_lbuf(buff); 01113 } 01114 if((key & SWEEP_COMMANDS) && (Typeof(what) != TYPE_EXIT)) { 01115 01116 /* 01117 * Look for commands on the object and parents too 01118 */ 01119 01120 ITER_PARENTS(what, parent, lev) { 01121 if(Commer(parent)) { 01122 cancom = 1; 01123 if(lev) { 01124 is_parent = 1; 01125 break; 01126 } 01127 } 01128 } 01129 } 01130 if(key & SWEEP_CONNECT) { 01131 if(Connected(what) || (Puppet(what) && Connected(Owner(what))) || 01132 (mudconf.player_listen && (Typeof(what) == TYPE_PLAYER) && 01133 canhear && Connected(Owner(what)))) 01134 isconnected = 1; 01135 } 01136 if(key & SWEEP_PLAYER || isconnected) { 01137 if(Typeof(what) == TYPE_PLAYER) 01138 isplayer = 1; 01139 if(Puppet(what)) 01140 ispuppet = 1; 01141 } 01142 if(canhear || cancom || isplayer || ispuppet || isconnected) { 01143 buf = alloc_lbuf("sweep_check.types"); 01144 bp = buf; 01145 01146 if(cancom) 01147 safe_str((char *) "commands ", buf, &bp); 01148 if(canhear) 01149 safe_str((char *) "messages ", buf, &bp); 01150 if(isplayer) 01151 safe_str((char *) "player ", buf, &bp); 01152 if(ispuppet) { 01153 safe_str((char *) "puppet(", buf, &bp); 01154 safe_str(Name(Owner(what)), buf, &bp); 01155 safe_str((char *) ") ", buf, &bp); 01156 } 01157 if(isconnected) 01158 safe_str((char *) "connected ", buf, &bp); 01159 if(is_parent) 01160 safe_str((char *) "parent ", buf, &bp); 01161 bp[-1] = '\0'; 01162 if(Typeof(what) != TYPE_EXIT) { 01163 notify_printf(player, " %s is listening. [%s]", Name(what), buf); 01164 } else { 01165 buf2 = alloc_lbuf("sweep_check.name"); 01166 StringCopy(buf2, Name(what)); 01167 for(bp = buf2; *bp && (*bp != ';'); bp++); 01168 *bp = '\0'; 01169 notify_printf(player, " %s is listening. [%s]", buf2, buf); 01170 free_lbuf(buf2); 01171 } 01172 free_lbuf(buf); 01173 } 01174 }
static void view_atr | ( | dbref | player, | |
dbref | thing, | |||
ATTR * | ap, | |||
char * | text, | |||
dbref | aowner, | |||
int | aflags, | |||
int | skip_tag | |||
) | [static] |
Definition at line 162 of file look.c.
References A_DESC, AF_IS_LOCK, AF_LOCK, AF_MDARK, AF_NOPROG, AF_PRIVATE, AF_REGEXP, AF_VISUAL, AF_WIZARD, Controls, attr::flags, free_boolexp(), attr::name, NOTHING, notify_printf(), attr::number, Owner, parse_boolexp(), and unparse_boolexp().
Referenced by debug_examine(), do_examine(), exam_wildattrs(), and look_atrs1().
00164 { 00165 char *buf; 00166 char xbuf[6]; 00167 char *xbufp; 00168 BOOLEXP *bool; 00169 00170 if(ap->flags & AF_IS_LOCK) { 00171 bool = parse_boolexp(player, text, 1); 00172 text = unparse_boolexp(player, bool); 00173 free_boolexp(bool); 00174 } 00175 /* 00176 * If we don't control the object or own the attribute, hide the * * 00177 * * * attr owner and flag info. 00178 */ 00179 00180 if(!Controls(player, thing) && (Owner(player) != aowner)) { 00181 if(skip_tag && (ap->number == A_DESC)) 00182 notify_printf(player, "%s", text); 00183 else 00184 notify_printf(player, "\033[1m%s:\033[0m %s", ap->name, text); 00185 return; 00186 } 00187 /* 00188 * Generate flags 00189 */ 00190 00191 xbufp = xbuf; 00192 if(aflags & AF_LOCK) 00193 *xbufp++ = '+'; 00194 if(aflags & AF_NOPROG) 00195 *xbufp++ = '$'; 00196 if(aflags & AF_PRIVATE) 00197 *xbufp++ = 'I'; 00198 if(aflags & AF_REGEXP) 00199 *xbufp++ = 'R'; 00200 if(aflags & AF_VISUAL) 00201 *xbufp++ = 'V'; 00202 if(aflags & AF_MDARK) 00203 *xbufp++ = 'M'; 00204 if(aflags & AF_WIZARD) 00205 *xbufp++ = 'W'; 00206 00207 *xbufp = '\0'; 00208 00209 if((aowner != Owner(thing)) && (aowner != NOTHING)) { 00210 notify_printf(player, "\033[1m%s [#%d%s]:\033[0m %s", ap->name, aowner, xbuf, text); 00211 } else if(*xbuf) { 00212 notify_printf(player, "\033[1m%s [%s]:\033[0m %s", ap->name, xbuf, text); 00213 } else if(!skip_tag || (ap->number != A_DESC)) { 00214 notify_printf(player, "\033[1m%s:\033[0m %s", ap->name, text); 00215 } else { 00216 notify_printf(player, "%s", text); 00217 } 00218 }