#include "copyright.h" #include #include "db.h" void main(int argc, char **argv) { struct object *o; dbref owner; dbref thing; if(argc < 1) { fprintf(stderr, "Usage: %s [owner]\n", *argv); exit(1); } if(argc >= 2) { owner = atol(argv[2]); } else { owner = NOTHING; } if(db_read(stdin) < 0) { fprintf(stderr, "%s: bad input\n", argv[0]); exit(5); } printf("%%!\n1000 dict begin\n"); for(o = db; o < db+db_top; o++) { /* don't show it if it isn't owned by the right player */ if(owner != NOTHING && o->owner != owner) continue; printf("/#%d 100 dict dup begin def\n", o - db); printf("/Name (%s) def\n", o->name); printf("/Owner /#%d def\n", o->owner); printf("/Location /#%d def\n", o->location); printf("/Pennies %d def\n", o->pennies); printf("/Type /"); switch(o->flags & TYPE_MASK) { case TYPE_ROOM: printf("Room"); break; case TYPE_EXIT: printf("Exit"); break; case TYPE_THING: printf("Thing"); break; case TYPE_PLAYER: printf("Player"); break; default: printf("Unknown%d", o->flags & TYPE_MASK); break; } printf(" def\n"); /* handle flags */ printf("/Flags [ "); if(o->flags & LINK_OK) printf("/LINK_OK "); if(o->flags & DARK) printf("/DARK "); if(o->flags & STICKY) printf("/STICKY "); if(o->flags & WIZARD) printf("/WIZARD "); if(o->flags & TEMPLE) printf("/TEMPLE "); #ifdef RESTRICTED_BUILDING if(o->flags & BUILDER) printf("/BUILDER "); #endif /* RESTRICTED_BUILDING */ printf(" ] def\n"); printf("/Key {/#%d %s} def\n", o->key, o->flags & ANTILOCK ? "false" : "true"); printf("/Description "); if (o->description) printf("(%s) def\n", o->description); else printf("null def\n"); printf("/Success "); if (o->succ_message) printf("(%s) def\n", o->succ_message); else printf("null def\n"); printf("/Fail "); if (o->fail_message) printf("(%s) def\n", o->fail_message); else printf("null def\n"); printf("/OtherFail "); if (o->ofail) printf("(%s) def\n", o->ofail); else printf("null def\n"); printf("/OtherSuccess "); if (o->osuccess) printf("(%s) def\n", o->osuccess); else printf("null def\n"); printf("/Contents [ "); DOLIST(thing, o->contents) { printf("/#d ", thing); } printf("] def\n"); if(o->exits != NOTHING) { if((o->flags & TYPE_MASK) == TYPE_ROOM) { printf("/Exits [ "); DOLIST(thing, o->exits) { printf("/#%d ", thing); } printf("] def\n"); } else { printf("/Home /#%d def\n", o->exits); } } putchar('\n'); } exit(0); }