[comp.sources.games] v03i050: omega - rogue like dungeon exploration, Part03/15

games-request@tekred.TEK.COM (01/20/88)

Submitted by: "Laurence R. Brothers" <brothers@paul.rutgers.edu>
Comp.sources.games: Volume 3, Issue 50
Archive-name: omega/Part03

#! /bin/sh

# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 3 (of 15)."
# Contents:  makefile.notsun oinv.c osite.c
# Wrapped by billr@tekred on Mon Jan 18 10:20:14 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f makefile.notsun -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"makefile.notsun\"
else
echo shar: Extracting \"makefile.notsun\" \(778 characters\)
sed "s/^X//" >makefile.notsun <<'END_OF_makefile.notsun'
X# This is a sample makefile submitted by an omega player 
X# not on a sun. You will have to at the least change the
X# BINDIR and LIBDIR lines.
X
XCFLAGS = -O
XLDFLAGS = -s
XLIBS = -lcurses -ltermlib
XBINDIR = /u/kyrimis/bin/games
XLIBDIR = /u/kyrimis/games/omega
X
XOBJ = o.o oaux1.o oaux2.o ochar.o ocity.o ocom.o odepths.o \
X      oeffect1.o oeffect2.o \
X      oetc.o ofile.o ogen.o oguild.o oinititem1.o oinititem2.o \
X      oinitmon0to3.o oinitmon4to7.o oinitmon8to10.o \
X      oinv.o oitem.o oitemf.o olev.o omon.o omonf.o omove.o \
X      oscr.o osite.o ospell.o otime.o outil.o
X
Xomega: $(OBJ)
X	cc $(LDFLAGS) $(OBJ) $(LIBS) -o omega
X
Xinstall: omega
X	mv omega $(BINDIR)
X	chmod u+s $(BINDIR)/omega
X	cp omega.* *.dat *.txt $(LIBDIR)
X
Xclean:
X	rm -rf *.o omega
X
X$(OBJ): odefs.h	oglob.h
X
END_OF_makefile.notsun
if test 778 -ne `wc -c <makefile.notsun`; then
    echo shar: \"makefile.notsun\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f oinv.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"oinv.c\"
else
echo shar: Extracting \"oinv.c\" \(12213 characters\)
sed "s/^X//" >oinv.c <<'END_OF_oinv.c'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987 */
X/* oinv.c */
X/* functions having to do with player item inventory */
X
X#include <strings.h>
X#include "oglob.h"
X
X/* from oitem */
Xextern void item_use();
X
X/* from oaux */
Xextern void calc_melee();
X
X/* from outil */
Xextern int random_range();
Xextern int inbounds();
Xextern int unblocked();
X
X/* from oscr */
Xextern void printm(),mprint(),drawvision(),xredraw(),menuprint();
Xextern void menuclear(),menu_i_print();
Xextern void refreshmsg(),dataprint();
Xextern char mgetc(),ynq();
X
X/* from omon */
Xextern void m_damage(),m_status_set(),m_status_reset(),m_pickup();
Xextern int m_statusp();
X
X
X/* oinv functions */
Xvoid pickup_at(),drop_at(),givemonster(),conform_lost_object();
Xvoid conform_unused_object(),add_item_to_pack(),drop_money();
Xvoid setplustr(),setchargestr(), setnumstr(),p_drop_at(),give_money();
Xvoid conform_lost_objects();
Xpob detach_money();
Xint get_money();
Xchar *itemid(),*cashstr();
Xint getitem(),badobject(),cursed(),inpack(),itemcompare();
X
X
X/* drops money, heh heh */
Xvoid drop_money()
X{
X  pob money;
X
X  money = detach_money();
X  if (money != NULL) {
X    if (Dlevel == 0) {
X      mprint("As soon as the money leaves your hand,");
X      mprint("a horde of scrofulous beggars snatch it up and are gone!");
X    }
X    else drop_at(Player.x,Player.y,money);
X  }
X  else Skipmonsters = TRUE;
X}
X
X
X
X/* returns some money from player back into "money" item.
X   for giving and dropping money */
Xpob detach_money()
X{
X  int c;
X  pob cash=NULL;
X  c = get_money(Player.cash);
X  if (c != ABORT) {
X    Player.cash -= c;
X    cash = ((pob) malloc(sizeof(objtype)));
X    make_cash(cash,Dlevel);
X    cash->basevalue = c;
X  }
X  return(cash);
X}
X
X
X/* gets a legal amount of money or ABORT */
Xint get_money(limit)
Xint limit;
X{
X  int c;
X  mprint("How much? ");
X  c = parsenum();
X  if (c > limit) {
X    printm("\nForget it, buddy.");
X    return(ABORT);
X  }
X  else return(c);
X}
X
X
X
X/* pick up from some location x,y */
Xvoid pickup_at(x,y)
Xint x,y;
X{
X  pol ol = Dungeon[Dlevel][x][y].things;
X  pol prev = NULL;
X  int i,spaceleft,done = FALSE;
X  char ans;
X
X  Fastmove = FALSE;
X  drawvision(Player.x,Player.y,Player.vision);
X  while ((ol != NULL) && (! done)) {
X    spaceleft = FALSE;
X    for (i=0;i<MAXITEMS;i++)
X      spaceleft |= (Player.possessions[i]==NULL);
X    printm("\nPick up ");
X    printm(itemid(ol->thing));
X    printm(" [ynq]: ");
X    done = ((ans = ynq()) == 'q');
X    if (ans == 'y') {
X      if ((! spaceleft) && (ol->thing->objchar != CASH)) {
X	mprint("You're carrying too many items!");
X	done = TRUE;
X      }
X      else if (Player.itemweight + ol->thing->weight >= Player.maxweight) {
X	printm("\nYou're carrying enough weight already!");
X	done = TRUE;
X      }
X      else {
X
X	add_item_to_pack(ol->thing);
X
X	/* if was first item */
X	if (ol == Dungeon[Dlevel][x][y].things) 
X	  Dungeon[Dlevel][x][y].things =
X	    Dungeon[Dlevel][x][y].things->next;
X	/* else for items in middle of list */
X	else prev->next = prev->next->next;
X      }
X    }
X    else prev = ol;
X    ol = ol->next;
X  }
X}
X
X
X
X
Xint badobject(index)
Xchar index;     
X{
X  return ((index < 'a') ||
X	  (index > 'z') ||
X	  (Player.possessions[index-'a'] == NULL));
X}
X
X
X/* put all of o on objlist at x,y on Dlevel */
Xvoid drop_at(x,y,o)
Xint x,y;
Xpob o;
X{
X  pol tmp = ((pol) malloc(sizeof(oltype)));
X  pob cpy = ((pob) malloc(sizeof(objtype)));
X  *cpy = *o;
X  cpy->used = FALSE;
X  tmp->thing = cpy;
X  tmp->next = Dungeon[Dlevel][x][y].things;
X  Dungeon[Dlevel][x][y].things = tmp;
X}  
X
X/* put n of o on objlist at x,y on Dlevel */
Xvoid p_drop_at(x,y,n,o)
Xint x,y;
Xint n;
Xpob o;
X{
X  pol tmp = ((pol) calloc(1,sizeof(oltype)));
X  tmp->thing = ((pob) calloc(1,sizeof(objtype)));
X  *(tmp->thing) = *o;
X  tmp->thing->used = FALSE;
X  tmp->thing->number = n;
X  printm("\nDropped ");
X  mprint(itemid(tmp->thing));
X  tmp->next = Dungeon[Dlevel][x][y].things;
X  Dungeon[Dlevel][x][y].things = tmp;
X}  
X
X
X/* returns a string for identified items */
Xchar *itemid(obj)
Xpob obj;
X{
X  char tstr[80];
X  int i;
X  if (obj->objchar==CASH){
X    strcpy(Str4,obj->truename);
X    return(Str4);
X  }
X  else {
X    if (Objects[obj->id].known > obj->known)
X      obj->known = Objects[obj->id].known;
X    
X    setnumstr(obj,tstr);
X    strcpy(Str4,tstr);
X    if (obj->known == 0)
X      strcat(Str4,obj->objstr);
X    else if (obj->known == 1)
X      strcat(Str4,obj->truename);
X    else {
X      if (obj->blessing < 0) {
X	strcat(Str4, "cursed ");
X	strcat(Str4, obj->truename);
X      }
X      else if (obj->blessing > 0) {
X	strcat(Str4, "blessed ");
X	strcat(Str4, obj->truename);
X      }
X      else strcat(Str4,obj->truename);
X      if (obj->number > 1) strcat(Str4,"s");
X      switch (obj->objchar) {
X      case STICK: 
X        setchargestr(obj,tstr);
X	strcat(Str4,tstr);
X	break;
X      case MISSILEWEAPON:
X      case ARMOR:
X      case RING:
X      case SHIELD:
X      case WEAPON: 
X	setplustr(obj,tstr);
X	strcat(Str4, tstr);
X	break;
X      default: strcat(Str4,""); break;
X      }
X    }
X    return(Str4);
X  }
X}
X
Xchar *cashstr(o)
Xpob o;
X{
X  if (Dlevel < 3) return("copper pieces");
X  else if (Dlevel < 7) return("silver pieces");
X  else if (Dlevel < 12) return("gold pieces");
X  else if (Dlevel < 20) return("semiprecious gems");
X  else if (Dlevel < 30) return("mithril pieces");
X  else if (Dlevel < 35) return("precious gems"); 
X  else return("orichalc pieces");
X}
X
X/* return an object's plus as a string */
Xvoid setplustr(obj,pstr)
Xpob obj;
Xchar pstr[72];
X{
X  pstr[0] = ' ';
X  pstr[1] = (obj->plus < 0 ? '-' : '+' );
X  if (abs(obj->plus) < 10) {
X    pstr[2] = '0' + abs(obj->plus);
X    pstr[3] = 0;
X  }
X  else {
X    pstr[2] = '0' + ((int)(abs(obj->plus / 10)));
X    pstr[3] = '0' + abs((obj->plus % 10));
X    pstr[4] = 0;
X  }
X}
X
X/* return an object's number as a string */
Xvoid setnumstr(obj,nstr)
Xpob obj;
Xchar nstr[10];
X{
X  if (obj->number < 2)
X    nstr[0] = 0;
X  else if (obj->number < 10) {
X    nstr[0] = '0' + obj->number;
X    nstr[1] = 'x';
X    nstr[2] = ' ';
X    nstr[3] = 0;
X  }
X  else if (obj->number < 41) {
X    nstr[0] = '0' + ((int)(obj->number / 10));
X    nstr[1] = '0' + (obj->number % 10);
X    nstr[2] = 'x';
X    nstr[3] = ' ';
X    nstr[4] = 0;
X  }
X  else strcpy(nstr,"lots of ");
X}
X
X
X
X
X/* return object with charges */
Xvoid setchargestr(obj,cstr)
Xpob obj;
Xchar cstr[72];
X{
X  cstr[0] = ' ';
X  cstr[1] = '[';
X
X  if (obj->charge < 10) {
X    cstr[2] = '0' + obj->charge;
X    cstr[3] = ']';
X    cstr[4] = 0;
X  }
X  else {
X    cstr[2] = '0' + ((int)(obj->charge / 10));
X    cstr[3] = '0' + (obj->charge % 10);
X    cstr[4] = ']';
X    cstr[5] = 0;
X  }
X}
X
X
Xvoid give_money(m)
Xstruct monster *m;
X{
X  int amount;
X  pob cash;
X
X  cash = detach_money();
X  if (cash == NULL)
X    Skipmonsters = TRUE;
X  else givemonster(m,cash);
X}
X    
X    
X
Xvoid givemonster(m,o)
Xstruct monster *m;
Xstruct object *o;
X{
X  conform_lost_objects(1,o);
X
X  printm("\nThe ");
X  printm(m->monstring);
X
X  if (m_statusp(m,GREEDY) || m_statusp(m,NEEDY)) {
X    m_pickup(m,o);
X    printm(" takes your offering ");
X    Player.alignment++;
X    if (m_statusp(m,GREEDY) && (true_item_value(o) < m->level*100))
X      mprint(" but does not appear satisfied.");
X    else if (m_statusp(m,NEEDY) && (true_item_value(o) < Dlevel*Dlevel))
X      mprint(" and looks chasteningly at you.");
X    else {
X      mprint(" and seems happy with it.");
X      m_status_reset(m,HOSTILE);
X      m_status_reset(m,GREEDY);
X      m_status_reset(m,NEEDY);
X    }
X  }
X  else if (m_statusp(m,HUNGRY)) {
X    if ((o->usef == I_FOOD) || (o->usef == I_POISON_FOOD)) {
X      mprint(" wolfs down your food ... ");
X      m_status_reset(m,HUNGRY);
X      m_status_reset(m,HOSTILE);
X      if  (o->usef == I_POISON_FOOD) {
X	Player.alignment -= 2;
X	mprint("and chokes on the poisoned ration!");
X	m_status_set(m,HOSTILE);
X	m_damage(m,100,POISON);
X      }
X      else mprint("and now seems satiated.");
X      free((char *) o);
X    }
X    else {
X      mprint(" ignores your offering.");
X      drop_at(m->x,m->y,o);
X    }
X  }
X  else {
X    printm(" does not seem interested in your offer");
X    drop_at(m->x,m->y,o);
X  }
X}
X
X
X
X/* clears lost possession from pack, by searching for it */
X/* will clear all, not just one */
Xvoid conform_lost_object(obj)
Xpob obj;
X{
X  int i;
X
X  Player.itemweight -= obj->weight*obj->number;
X  for(i=0;i<MAXITEMS;i++) 
X    if (Player.possessions[i] == obj) {
X      Player.possessions[i] = NULL;
X      conform_unused_object(obj);
X    }
X}
X
Xvoid conform_lost_objects(n,obj)
Xint n;
Xpob obj;
X{
X  int i;
X  Player.itemweight -= n*obj->weight;
X  for(i=0;i<MAXITEMS;i++) 
X    if (Player.possessions[i] == obj) {
X      obj->number -= n;
X      if (obj->number < 1) {
X	Player.possessions[i] = NULL;
X	conform_unused_object(obj);
X      }
X    }
X}
X
X/* clears unused possession */
Xvoid conform_unused_object(obj)
Xpob obj;
X{
X  if (obj->used) {
X    obj->used = FALSE;
X    switch(obj->objchar) {
X      case SHIELD: 
X      case WEAPON: item_use(obj);
X		   if (Player.primary == obj)
X		     Player.primary = NULL;
X	           if (Player.secondary == obj)
X		     Player.secondary = NULL;
X		   break;
X      case ARMOR:  item_use(obj);
X		   Player.armor = NULL; break;
X      case CLOAK:  item_use(obj);
X		   Player.cloak = NULL; break;
X      case BOOTS:  item_use(obj);
X		   Player.boots = NULL; break;
X      case RING:   item_use(obj);
X		   Player.boots = NULL; break;
X    }
X  }
X  calc_melee();
X}
X
X
X/* select an item from inventory */
Xint getitem(itype)
Xchar itype;
X{
X  char invstr[64];
X  char item[2];
X  int i,index,ok=FALSE,drewmenu=FALSE,found=FALSE;
X
X  found = ((itype == NULL) && (Player.cash > 0));
X  item[1] = 0;
X  strcpy(invstr,"Select an item [");
X  if (itype == NULL) strcat(invstr,"$");
X  for(i=0;i<MAXITEMS;i++)
X    if ((Player.possessions[i] != NULL) &&
X	((itype == NULL) ||
X	 (Player.possessions[i]->objchar == itype))) {
X	   found = TRUE;
X	   item[0] = 'a'+i;
X	   strcat(invstr,item);
X	 }
X  strcat(invstr,",?,ESCAPE]:");
X  if (found == FALSE) {
X    if (itype == FOOD) return(getitem(CORPSE));
X    else {
X      mprint("Nothing appropriate.");
X      return(ABORT);
X    }
X  }
X  else {
X    mprint(invstr);
X    while (! ok) {
X      index = mgetc();
X      if (index == '?') {
X	drewmenu = TRUE;
X	menuclear();
X	if (itype == NULL) {
X	  menuprint("$: ");
X	  menunumprint(Player.cash);
X	  menuprint("Au.\n");
X	}
X	for (i=0;i<MAXITEMS;i++)
X	  if (Player.possessions[i] != NULL)
X	    if ((itype == NULL) || 
X		(Player.possessions[i]->objchar == itype))
X	      menu_i_print(i);
X	menuprint("\n---More---");
X	refreshmsg();
X      }
X      else if ((index != ESCAPE) && (index != '$') && badobject(index))
X	printm("\nBad choice! Try again [? for inventory, ESCAPE to quit]:");
X      else ok = TRUE;
X    }
X    if (drewmenu) xredraw();
X    if (index == ESCAPE) return(ABORT);
X    else if (index == '$') return(CASHVALUE);
X    else return(index);
X  }
X}
X
X
X  
X  
Xint itemcompare(a,b)
Xpob a,b;
X{
X  return((a->id == b->id) &&
X	 (a->plus == b->plus) &&
X	 (a->blessing == b->blessing) &&
X	 (a->charge == 0) &&
X	 (b->charge == 0) &&
X	 (a->aux == b->aux) &&
X	 (a->known == b->known) &&
X	 (! a->used) &&
X	 (! b->used));
X}
X
Xvoid add_item_to_pack(o)
Xstruct object *o;
X{
X  int i,gotten=FALSE;
X  if (o->objchar == CASH)
X    Player.cash += o->basevalue;
X  else {
X    for(i=0;((i<MAXITEMS) && (!gotten));i++)
X      if (Player.possessions[i] != NULL)
X	if (itemcompare(Player.possessions[i],o)) {
X	  Player.itemweight += o->weight*o->number;
X	  gotten = TRUE;
X	  Player.possessions[i]->number+=o->number;
X	}
X    for(i=0;((i<MAXITEMS) && (!gotten));i++)
X      if (Player.possessions[i] == NULL) {
X	Player.itemweight += o->weight*o->number;
X	gotten = TRUE;
X	Player.possessions[i] = o;
X      }
X    if (! gotten) {
X      mprint("The item falls to the ground.");
X      drop_at(Player.x,Player.y,o);
X    }
X  }
X  calc_melee();
X  dataprint();
X}
X
X
Xint cursed(obj)
Xpob obj;
X{
X  return((obj == NULL) ? FALSE : (obj->blessing < 0));
X}
X
X
X/* if object with id and auxval is inpack, return index, else return
XABORT (-1) -- if auxval is -1, ignore it */
Xint inpack(id,auxval)
Xint id,auxval;
X{
X  int i,found=FALSE;
X
X  for(i=0;((i<MAXITEMS)&&(!found));i++)
X    found = ((Player.possessions[i] != NULL) &&
X	     (Player.possessions[i]->id == id) &&
X	     ((auxval == -1) ||
X	      (Player.possessions[i]->aux == auxval)));
X  return(found ? i-1 : ABORT);
X}
END_OF_oinv.c
if test 12213 -ne `wc -c <oinv.c`; then
    echo shar: \"oinv.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f osite.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"osite.c\"
else
echo shar: Extracting \"osite.c\" \(41351 characters\)
sed "s/^X//" >osite.c <<'END_OF_osite.c'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987 */
X/* osite.c */
X/* L_ functions  */ 
X
X#include <strings.h>
X#include "oglob.h"
X
X/* from ofile */
Xextern void theologyfile(),cityguidefile();
X
X/* from ospell */
Xextern char *spellid();
X
X/* from ocom */
Xextern void levelchange();
X
X/* from oinv */
Xextern char *itemid();
Xextern int inpack(),get_money();
Xextern void conform_lost_objects();
X/* from odepths.c */
Xextern void final_duel();
X
X/* from oetc */
Xextern void hint(),learnclericalspells(),nameprint();
Xextern char *slotstr();
X
X/* from omon */
Xextern int corpse_value();
Xextern void transform_corpse(),m_status_set();
X
X/* from oaux */
Xextern void conform_lost_object(),conform_unused_object(),p_death();
Xextern void p_damage(),p_poison(),calc_melee(),gain_experience();
Xextern void add_item_to_pack(),p_drown(),p_teleport(),p_win(),foodcheck();
Xextern void toggle_item_use();
Xextern int item_value(),true_item_value();
X
X/* from oguild */
Xextern void l_altar();
X
X
X/* from oeffect (1 or 2)*/
Xextern void disintegrate(),identify(),level_drain(),augment(),cleanse();
Xextern void heal(),acquire(),enchant(),bless(),learnspell(),dispel();
X
X/* from outil */
Xextern int random_range(),hour();
X
X/* from oscr */
Xextern void mprint(),menuclear(),menuprint(),xredraw(),printm(),showflags();
Xextern void menu_item_print(),mnumprint(),dataprint(),show_screen();
Xextern void morewait(),drawvision(),drawomega();
Xextern char ynq(),mgetc(),*msgscanstring(),mcigetc(),menugetc();
Xextern void screencheck();
X
X/* from oitem */
Xextern pob create_object();
X
X/* from olev */
Xpmt m_create();
X
X
X
X/* site p_locf functions */
X
Xvoid l_temple(),l_armorer(),l_club(),l_gym();
Xvoid l_healer(),l_statue_wake(),l_casino(),l_bank();
Xvoid l_sewer(),l_tavern(),l_alchemist(),l_vault();
Xvoid l_citygate(),l_dpw(),l_library(),l_pawn_shop(),l_chaosstorm();
Xvoid l_condo(),l_cemetary(),l_residence(),l_garden();
Xvoid l_jail(),l_adept(),l_trifid(),l_final_abyss(),l_warning();
Xvoid l_portcullis(),l_portcullis_trap(),l_guardian(),l_challenge();
X
X/* auxiliary functions */
Xvoid healforpay(),cureforpay(),gymtrain(),buyfromstock(),wake_statue();
Xvoid send_to_jail();
X
X
X
X
X/* the bank; can be broken into (!) */
Xvoid l_bank()
X{
X  int done=FALSE,valid=FALSE,amount;
X  char response;
X  char passwd[64];
X
X  if (Bank_Broken)
X    mprint("You see a damaged autoteller.");
X  else {
X    mprint("First Omegan Bank -- Autoteller Working.");
X    while (! done) {
X      printm("\nCurrent Balance: ");
X      mnumprint(Balance);
X      mprint(" Au. ");
X      menuclear();
X      menuprint("Enter command > ");
X      response = menugetc();
X      if (response == '?') {
X	menuclear();
X	menuprint("?: This List.\n");
X	if (strcmp(Password,"")==0)
X	  menuprint("O: Open an account.\n");
X	else {
X	  menuprint("P: Enter password.\n");
X	  menuprint("D: Deposit.\n");
X	  menuprint("W: Withdraw\n");
X	}
X	menuprint("X: eXit\n");
X	morewait();
X      }
X      else if ((response == 'P') && (strcmp(Password,"") != 0)) {
X	menuclear();
X	menuprint("Enter password above: \n");
X	printm("\nPassword: ");
X	strcpy(passwd,msgscanstring());
X	valid = (strcmp(passwd,Password)==0);
X	if (! valid) {
X	  done = TRUE;
X	  menuclear();
X	  menuprint("Alert! Alert! Invalid Password!\n");
X	  menuprint("The police are being summoned!\n");
X	  menuprint("Please wait for the police to arrive....\n\n");
X	  menuprint("----Hit space bar to continue----\n");
X	  response = menugetc();
X	  if (response == SPACE) {
X	    xredraw();
X	    mprint("Ah ha! Trying to rob the bank, eh?");
X	    mprint("Take him away, boys!");
X	    send_to_jail();
X	  }
X	  else {
X	    menuclear();
X	    sleep(3);
X	    menuprint("^@^@^@^@^@00AD1203BC0F0000FFFFFFFFFFFF\n");
X	    menuprint("Interrupt in _get_space. Illegal Character.\n");
X	    sleep(3);
X	    menuprint("Aborting _police_alert.....\n");
X	    menuprint("Attempting reboot.....\n");
X	    sleep(3);
X	    menuprint("Warning: Illegal shmop at _count_cash.\n");
X	    menuprint("Warning: Command Buffer NOT CLEARED\n");
X	    sleep(3);
X	    menuprint("Reboot Complete. Execution Continuing.\n");
X	    menuprint("Withdrawing: 4294967297 Au.\n");
X	    menuprint("Warning: Arithmetic Overflow in _withdraw\n");
X	    sleep(3);
X	    menuprint("Yo mama. Core dumped.\n");
X	    sleep(3);
X	    xredraw();
X	    mprint("The cash machine begins to spew gold pieces!");
X	    mprint("You pick up your entire balance and then some!");
X	    Player.cash += Balance + random_range(3000);
X	    Balance = 0;
X	    Bank_Broken = TRUE;
X	  }
X	}
X	else menuprint("Password accepted. Working.\n");
X      }
X      else if ((response == 'D') && valid) {
X	menuclear();
X	menuprint("Enter amount to deposit above.\n");
X	printm("\nAmount: ");
X	amount = get_money(Player.cash);
X	if (amount < 1) menuprint("Transaction aborted.\n");
X	else {
X	  menuprint("Transaction accomplished.\n");
X	  Balance += amount;
X	  Player.cash -= amount;
X	}
X      }
X      else if ((response == 'W') && valid) {
X	menuclear();
X	menuprint("Enter amount to withdraw above.\n");
X	printm("\nAmount: ");
X	amount = get_money(Balance);
X	if (amount < 1) menuprint("Transaction aborted.\n");
X	else if (amount > Balance) 
X	  menuprint("Withdrawal too large -- aborted.\n");
X	else {
X	  menuprint("Transaction accomplished.\n");
X	  Balance -= amount;
X	  Player.cash += amount;
X	}
X      }
X      else if (response == 'X') {
X	menuclear();
X	menuprint("\n\nBye!\n\n");
X	done = TRUE;
X      }
X      else if ((response == 'O') && (strcmp(Password,"")==0)) {
X	menuclear();
X	menuprint("Opening new account.\n");
X	menuprint("Please enter password above.\n");
X	printm("\nPassword: ");
X	strcpy(Password,msgscanstring());
X	if (strcmp(Password,"")==0) {
X	  menuprint("Illegal to use null password -- aborted.\n");
X	  done = TRUE;
X	}
X	else {
X	  menuprint("Password validated; account saved.\n");
X	  valid = TRUE;
X	}
X      }
X      else menuprint(" Illegal command.\n");
X      dataprint();
X      morewait();
X    }
X  }
X  xredraw();
X}
X
X
X
X/* The druid's altar in the botanical garden */
Xvoid l_druid()
X{
X  char response;
X  mprint("You have entered the Inner Sanctum of the ArchDruid.");
X  if (! Sawdruid) {
X    mprint("The Archdruid congratulates you on reaching his sanctum.");
X    mprint("You feel competent.");
X    gain_experience(250);
X    Sawdruid = TRUE;
X  }
X  menuclear();
X  menuprint("\na: Continue to the altar or leave.");
X  menuprint("\nb: Request a cleansing rite.");
X  response = mgetc();
X  if (response == 'a') {
X    mprint("You may proceed");
X    l_altar();
X  }
X  else if (response == 'b') {
X    if (abs(Player.alignment > 3))
X      mprint("You are not in tune with the Cosmic Balance!");
X    else {
X      mprint("The ArchDruid conducts a sacred rite of cleansing....");
X      cleanse(0);
X      mprint("The ArchDruid sends you on your way with a teleport spell.");
X      p_teleport(1);
X    }
X  }
X  else {
X    mprint("You must not come this way without a serious purpose. Begone!");
X    p_teleport(0);
X  }
X  xredraw();
X}
X
X
Xvoid l_temple()
X{
X  mprint("You pass the ornate portico of the Rampart Pantheon.");
X}
X
Xvoid l_armorer()
X{
X  int done = FALSE;
X  char action;
X
X  mprint("You have entered Julie's: 'Armorer Par Excellence'");
X  if (hour() == 12) 
X    mprint("Unfortunately, this is her lunch hour -- try again later.");
X  else if (nighttime()) 
X    mprint("It seems that Julie keeps regular business hours.");
X  else while (! done) {
X    printm("\nJulie's: Buy Armor, Weapons, or Leave [a,w,ESCAPE] ");
X    action = mgetc();
X    if (action == ESCAPE) 
X      done = TRUE;
X    else if (action == 'a') 
X      buyfromstock(ARMORID,10);
X    else if (action == 'w') 
X      buyfromstock(WEAPONID,23);
X  }
X  xredraw();
X}
X
X
Xvoid buyfromstock(base,numitems)
Xint base,numitems;  
X{
X  int i,j;
X  char item;
X  pob newitem;
X
X  printm("\nPurchase which item? [ESCAPE to quit] ");
X  menuclear();
X  for(i=0;i<numitems;i++) 
X    menu_item_print(i,&(Objects[base+i]));
X  item = ' ';
X  while ((item != ESCAPE) &&
X	 ((item < 'a') || (item >= 'a'+numitems)))
X    item = mgetc();
X  if (item != ESCAPE) {
X    i = item - 'a';
X    newitem = ((pob) calloc(1,sizeof(objtype)));
X    *newitem = Objects[base+i];
X    newitem->known = 2;
X    printm("\nI can let you have it for ");
X    mnumprint(2*true_item_value(newitem));
X    printm(" in gold.");
X    mprint(" Buy it? [ynq] ");
X    if (ynq() == 'y') {
X      if (Player.cash < 2*true_item_value(newitem)) {
X	mprint("Why not try again some time you have the cash?");
X	free((char *) newitem);
X      }
X      else {
X	Player.cash -= 2*true_item_value(newitem);
X	dataprint();
X	add_item_to_pack(newitem);
X      }
X    }
X    else free((char *)newitem);
X  }
X}
X
X
Xvoid l_club()
X{
X  static int hinthour = 0;
X  char response;
X
X  mprint("Rampart Explorers' Club.");
X  if (! Clubmember) {
X    if (Player.level < 2) mprint("Only reknowned adventurers need apply.");
X    else {
X      mprint("Dues are 100Au. Pay it? [yn] ");
X      if (ynq()=='y') {
X	if (Player.cash < 100)
X	  mprint("Beat it, or we'll blackball you!");
X	else {
X	  mprint("Welcome to the club!");
X	  mprint("You are taught the spell of Return");
X	  Spells[S_RETURN].known = TRUE;
X	  Player.cash -= 100;
X	  Clubmember = TRUE;
X	}
X      }
X      else mprint("OK, but you're missing out on our benefits....");
X    }
X  }
X  else {
X    mprint("Shop at the club store or listen for rumors [sl] ");
X    do response = mgetc(); 
X    while ((response != 's') && (response != 'l') && (response != ESCAPE));
X    if (response == 'l') {
X      if (hinthour == hour()) mprint("You don't hear anything useful.");
X      else {
X	mprint("You overhear a conversation....");
X	hint();
X	hinthour = hour();
X      }
X    }
X    else if (response == 's') {
X      buyfromstock(THINGID+7,2);
X      xredraw();
X    }
X    else if (response == ESCAPE)
X      mprint("Be seeing you, old chap!");
X  }
X}
X
Xvoid l_gym()
X{
X  int done=TRUE;
X  mprint("The Rampart Gymnasium, (affil. Rampart Coliseum).");
X  if (Gymcredit<0) {
X    mprint("You must pay us: ");
X    mnumprint(abs(Gymcredit));
X    mprint("before you may train here again.");
X    mprint("Pay it? [yn]");
X    if (ynq()=='y') {
X      if (Player.cash < abs(Gymcredit))
X	mprint("Sorry, you don't have it!");
X      else {
X	Player.cash += Gymcredit;
X	Gymcredit = 0;
X	dataprint();
X      }
X    }
X    else mprint("See you around, deadbeat.");
X  }
X  do {
X    if (Gymcredit>0) {
X      mprint("You currently have: ");
X      mnumprint(Gymcredit);
X      mprint("Au credit here.");
X    }
X    if (Gymcredit > -1) {
X      done = FALSE;
X      menuclear();
X      menuprint("Train for 2000 crowns");
X      menuprint("\n\nChoose:");
X      menuprint("\na: work out in the weight room");
X      menuprint("\nb: use our gymnastics equipment");
X      menuprint("\nc: take our new anaerobics course");
X      menuprint("\nd: enroll in dance lessons.");
X      menuprint("\nESCAPE: Leave this place.");
X      switch(mgetc()) {
X      case 'a': 
X	gymtrain(&(Player.maxstr),&(Player.str));
X	break;
X      case 'b': 
X	gymtrain(&(Player.maxdex),&(Player.dex));
X	break;
X      case 'c': 
X	gymtrain(&(Player.maxcon),&(Player.con));
X	break;
X      case 'd':
X	gymtrain(&(Player.maxagi),&(Player.agi));
X	break;
X      case ESCAPE:
X	mprint("Well, it's your body you're depriving!"); 
X	done = TRUE;
X	break;
X      }
X    }
X  } while (! done);
X  xredraw();
X  calc_melee();
X}
X
X
X
Xvoid l_healer()
X{
X  mprint("Rampart Healers. Member RMA.");
X  menuclear();
X  menuprint("Choose:");
X  menuprint("\na: Heal injuries (50 crowns)");
X  menuprint("\nb: Cure disease (250 crowns)");
X  menuprint("\nESCAPE: Leave this place.");
X  switch(mgetc()) {
X    case 'a': healforpay(); break;
X    case 'b': cureforpay(); break;
X    default: mprint("OK, but suppose you have Acute Satyriasis?"); break;
X  }	      
X  xredraw();
X}
X
Xvoid l_statue_wake()
X{
X  int i;
X  int x=Player.x,y=Player.y;
X  for(i=0;i<9;i++)
X    wake_statue(x+Dirs[0][i],y+Dirs[1][i],TRUE);
X}
X
Xvoid wake_statue(x,y,first)
Xint x,y,first;
X{
X  int i;
X  pml tml;
X  if (Dungeon[Dlevel][x][y].locchar == STATUE) {
X    if (! first) mprint("Another statue awakens!");
X    else mprint("The statue springs to life!");
X    Dungeon[Dlevel][x][y].locchar = FLOOR;
X    tml = ((pml) calloc(1,sizeof(mltype)));
X    tml->m =
X      (Dungeon[Dlevel][x][y].creature = m_create(x,y,0,Dlevel+3));
X    tml->next = Mlist[Dlevel];
X    Mlist[Dlevel] = tml;
X    for(i=0;i<8;i++) wake_statue(x+Dirs[0][i],y+Dirs[1][i],FALSE);
X  }
X}
X
X
Xvoid l_casino()
X{
X  int i,done = FALSE,a,b,c,match;
X  static int winnings = 0;
X  char response;
X  mprint("Rampart Mithril Nugget Casino.");
X  if (random_range(10)==1)
X    mprint("Closed due to Grand Jury investigation.");
X  else {
X    menuclear();
X    menuprint("a: Drop 100Au in the slots.\n");
X    menuprint("b: Risk 1000Au  at roulette.\n");
X    menuprint("ESCAPE: Leave this green baize hall.\n");
X    while (! done) {
X      response = mgetc();
X      if (response == 'a') {
X	if (Player.cash < 100) mprint("No credit, jerk.");
X	else {
X	  Player.cash -= 100;
X	  dataprint();
X	  for(i=0;i<20;i++) {
X	    if (i==19) sleep(1);
X	    a = random_range(10);
X	    b = random_range(10);
X	    c = random_range(10);
X	    printm("\n");
X	    printm(slotstr(a));
X	    printm(slotstr(b));
X	    printm(slotstr(c));
X	  }
X	  if (winnings > 0) do {
X	    a = random_range(10);
X	    b = random_range(10);
X	    c = random_range(10);
X	  } while ((a==b) || (a == c) || (b == c));
X	  else {
X	    a = random_range(10);
X	    b = random_range(10);
X	    c = random_range(10);
X	  }
X	  printm("\n");
X	  printm(slotstr(a));
X	  printm(slotstr(b));
X	  printm(slotstr(c));
X	  if ((a==b) && (a==c)) {
X	    mprint("Jackpot Winner!");
X	    winnings += (a+2)*(b+2)*(c+2)*5;
X	    Player.cash += (a+2)*(b+2)*(c+2)*5;
X	    dataprint();
X	  }
X	  else if (a==b) {
X	    mprint("Winner!");
X	    Player.cash += (a+2)*(b+2)*5;
X	    dataprint();
X	    winnings += (a+2)*(b+2)*5;
X	  }
X	  else if (a==c) {
X	    mprint("Winner!");
X	    Player.cash += (a+2)*(c+2)*5;
X	    dataprint();
X	    winnings += (a+2)*(c+2)*5;
X	  }
X	  else if (c==b) {
X	    mprint("Winner!");
X	    Player.cash += (c+2)*(b+2)*5;
X	    dataprint();
X	    winnings += (c+2)*(b+2)*5;
X	  }
X	  else {
X	    mprint("Loser!");
X	    winnings -= 100;
X	  }
X	}
X      }
X      else if (response == 'b') {
X	if (Player.cash < 1000) mprint("No credit, jerk.");
X	else {
X	  Player.cash -= 1000;
X	  dataprint();
X	  mprint("Red or Black? [rb]");
X	  do response = mgetc();
X	  while ((response != 'r') && (response != 'b'));
X	  match = (response == 'r' ? 0 : 1);
X	  for(i=0;i<20;i++) {
X	    if (i==19) sleep(1);
X	    a = random_range(37);
X	    b = a % 2;
X	    printm("\n");
X	    if (a == 0) printm(" 0 ");
X	    else if (a==1) printm(" 0 - 0 ");
X	    else {
X	      printm(( b == 0) ? "Red ": "Black ");
X	      mnumprint(a-1);
X	    }
X	  }
X	  if (winnings > 0) do {
X	    a = random_range(37);
X	    b = a % 2;
X	  } while (b == match);
X	  else {
X	    a = random_range(37);
X	    b = a % 2;
X	  }
X	  printm("\n");
X	  if (a == 0) printm(" 0 ");
X	  else if (a==1) printm(" 0 - 0 ");
X	  else {
X	    printm((b == 0) ? "Red ": "Black ");
X	    mnumprint(a-1);
X	  }
X	  if ((a > 1) && (b == match)){
X	    mprint(" Winner!");
X	    winnings += 1000;
X	    Player.cash += 2000;
X	    dataprint();
X	  }
X	  else {
X	    mprint(" Loser!");
X	    winnings -= 1000;
X	    dataprint();
X	  }
X	}
X      }
X      else if (response == ESCAPE) done = TRUE;
X    }
X    xredraw();
X  }
X}
X
X
X
Xvoid l_sewer()
X{
X  mprint("A sewer entrance. You don't want to go down THERE, do you?");
X}
X
Xvoid l_tavern()
X{
X  static int type;
X  static int hinthour;
X  char response;
X  pob food;
X  if ((Dungeon[Dlevel][Player.x][Player.y].aux < 1) ||
X      (Dungeon[Dlevel][Player.x][Player.y].aux > 4)) {
X    Dungeon[Dlevel][Player.x][Player.y].aux = (type % 4) + 1;
X    type++;
X  }
X  switch(Dungeon[Dlevel][Player.x][Player.y].aux) {
X  case 1:
X    mprint("Commandant Sonder's Rampart-fried Lyzzard partes. Open 24 hrs.");
X    mprint("Buy a bucket! Only 5 Au. Make a purchase? [yn]");
X    if (ynq()=='y') {
X      if (Player.cash < 5) 
X	mprint("No handouts here, mac!");
X      else {
X	Player.cash -= 5;
X	food = ((pob) calloc(1,sizeof(objtype)));
X	*food = Objects[FOODID+0]; /* food ration */
X	add_item_to_pack(food);
X	mprint("There you go, mac! One Lyzzard Bucket, coming up.");
X      }
X    }
X    else mprint("Don't blame the Commandant if you starve!");
X    break;
X  case 2:
X    mprint("The Rampart Diner. All you can eat, 25Au.");
X    mprint("Place an order? [yn]");
X    if (ynq()=='y') {
X      if (Player.cash < 25)
X	mprint("TANSTAAFL! Now git!");
X      else {
X	Player.cash -= 25;
X	dataprint();
X	Player.food = 24;
X	foodcheck();
X      }
X    }
X    break;
X  case 3:
X    mprint("Les Crapeuleaux. (****)");
X    if (nighttime()) mprint ("So sorry, we are closed 'til the morrow...");
X    else {
X      mprint("May I take your order? [yn]");
X      if (ynq()=='y') {
X	if (Player.cash < 1000)
X	  mprint("So sorry, you have not the funds for dinner.");
X	else {
X	  mprint("Hope you enjoyed your tres expensive meal, m'sieur...");
X	  Player.cash -= 1000;
X	  dataprint();
X	  Player.food += 6;
X	  foodcheck();
X	}
X      }
X    }
X    break;
X  case 4:
X    mprint("The Centaur and Nymph -- J. Riley, prop.");
X    if (nighttime()) {
X      menuclear();
X      menuprint("Riley says: Whataya have?\n\n");
X      menuprint("a: Pint of Riley's ultra-dark 1Au\n");
X      menuprint("b: Shot of Tullimore Dew 10Au\n");
X      menuprint("c: Round for the House. 100Au\n");
X      menuprint("d: Bed and Breakfast. 25Au\n");
X      menuprint("ESCAPE: Leave this comfortable haven.\n");
X      do response = mcigetc();
X      while ((response != 'a') &&
X	     (response != 'b') &&
X	     (response != 'c') &&
X	     (response != 'd') &&
X	     (response != ESCAPE));
X      switch (response) {
X      case 'a':
X	if (Player.cash < 1)
X	  mprint("Aw hell, have one on me.");
X	else {
X	  hinthour == hour();
X	  Player.cash -= 1;
X	  dataprint();
X	  if (hinthour!=hour()) {
X	    if (random_range(3)) {
X	      mprint("You overhear a rumor...");
X	      hint();
X	    }
X	    else mprint("You don't hear much of interest.");
X	    hinthour = hour();
X	  }
X	  else mprint("You just hear the same conversations again.");
X	}
X	break;
X      case 'b':
X	if (Player.cash < 10)
X	  mprint("I don't serve the Dew on no tab, buddy!");
X	else {
X	  Player.cash -= 10;
X	  mprint("Ahhhhh....");
X	  if (Player.status[POISONED] || Player.status[DISEASED])
X	    mprint("Phew! That's, er, smooth stuff!");
X	  Player.status[POISONED] = 0;
X	  Player.status[DISEASED] = 0;
X	  showflags();
X	}
X	break;
X      case 'c':
X	if (Player.cash < 100) {
X	  mprint("Whatta feeb!");
X	  mprint("Outta my establishment.... Now!");
X	  p_damage(random_range(20),UNSTOPPABLE,"Riley's right cross");
X	}
X	else {
X	  Player.cash -= 100;
X	  dataprint();
X	  mprint("'What a guy!'"); morewait();
X	  mprint("'Hey, thanks, fella.'"); morewait();
X	  mprint("'Make mine a double...'"); morewait();
X	  switch(random_range(4)) {
X	  case 0:
X	    mprint("'You are a real pal. Say, have you heard.... ");
X	    hint();
X	    break;
X	  case 1:
X	    mprint("A wandering priest of Dionysus blesses you...");
X	    if ((Player.patron == ODIN) || (Player.patron == ATHENA))
X	      Player.alignment++;
X	    else if ((Player.patron == HECATE) || (Player.patron == SET))
X	      Player.alignment--;
X	    else if (Player.alignment > 0) Player.alignment--;
X	    else Player.alignment++;
X	    break;
X	  case 2:
X	    mprint("A thirsty bard promises to put your name in a song!");
X	    gain_experience(20);
X	    break;
X	  case 3:
X	    mprint("Riley draws you a shot of his 'special reserve'");
X	    mprint("Drink it [yn]?");
X	    if (ynq()=='y') {
X	      if (Player.con < random_range(20)) {
X		mprint("<cough> Quite a kick!");
X		mprint("You feel a fiery warmth in your tummy....");
X		Player.con++;
X		Player.maxcon++;
X	      }
X	      else mprint("You toss it back nonchalantly.");
X	    }
X	  }		
X	}
X	break;
X      case 'd':
X	if (Player.cash < 25)
X	  mprint("Pay in advance, mac!");
X	else {
X	  Player.cash -= 25;
X	  mprint("How about a shot o' the dew for a nightcap?");
X	  if (hour() > 12) Time += ((24-hour())+8) * 100;
X	  else Time += ((9-hour())*100);
X	  Player.status[POISONED] = 0;
X	  Player.status[DISEASED] = 0;
X	  Player.food = 18;
X	  /* reduce temporary stat gains to max stat levels */
X	  toggle_item_use(TRUE);
X	  Player.str = min(Player.str,Player.maxstr);
X	  Player.con = min(Player.con,Player.maxcon);
X	  Player.agi = min(Player.agi,Player.maxagi);
X	  Player.dex = min(Player.dex,Player.maxdex);
X	  Player.iq = min(Player.iq,Player.maxiq);
X	  Player.pow = min(Player.pow,Player.maxpow);
X	  toggle_item_use(FALSE);
X	  timeprint();
X	  dataprint();
X	  showflags();
X	  mprint("The next morning.....");
X	}
X	break;
X      default:
X	mprint("So? Just looking? Go on!");
X	break;
X      }
X    }
X    else mprint("The pub don't open til dark, fella.");
X    xredraw();
X    break;
X  }
X}
X
Xvoid l_alchemist()
X{
X  int i,done=FALSE,mlevel;
X  char response;
X  pob obj;
X  mprint("Ambrosias' Potions et cie.");
X  if (nighttime()) 
X    mprint("Ambrosias doesn't seem to be in right now.");
X  else while (! done){
X    menuclear();
X    menuprint("a: Sell monster components\n");
X    menuprint("b: Pay for transformation.\n");
X    menuprint("ESCAPE: Leave this place.\n");
X    response = mgetc();
X    if (response == 'a') {
X      done = TRUE;
X      i = getitem(CORPSE);
X      if ((i != ABORT) && (Player.possessions[i-'a'] != NULL)){
X	obj = Player.possessions[i-'a'];
X	if (Monsters[obj->aux].transformid == -1) {
X	  mprint("I don't want such a thing.");
X	  if (obj->basevalue > 0)
X	    mprint("You might be able to sell it to someone else, though.");
X	}
X	else {
X	  printm("\nI'll give you ");
X	  mnumprint(obj->basevalue/3);
X	  printm("Au for it. Take it? [ynq]");
X	  if (ynq()=='y') {
X	    Player.cash += (obj->basevalue/3);
X	    conform_lost_objects(1,obj);
X	  }
X	  else mprint("Well, keep the smelly old thing, then!");
X	}
X      }
X      else mprint("So nu?");
X    }
X    else if (response == 'b') {
X      done = TRUE;
X      i = getitem(CORPSE);
X      if ((i != ABORT) && (Player.possessions[i-'a'] != NULL)){
X	obj = Player.possessions[i-'a'];
X	mlevel = Monsters[obj->aux].level;
X	printm("\nIt'll cost you ");
X 	mnumprint(max(10,obj->basevalue*2));
X	printm("for the transformation. Pay it? [ynq]");
X	if (ynq()=='y') {
X 	  if (Player.cash < max(10,obj->basevalue*2))
X	    mprint("You can't afford it!");
X	  else if (Monsters[obj->aux].transformid == -1) {
X 	      mprint("There is a puff of smoke, and the corpse disappears.");
X 	      conform_lost_objects(1,obj);
X 	    }
X	  else {
X	    mprint("Voila! A tap of the Philosopher's Stone...");
X	    Player.cash -= obj->basevalue*2;
X	    *obj = Objects[Monsters[obj->aux].transformid];
X	    if ((obj->id >= STICKID) && (obj->id < STICKID+NUMSTICKS))
X	      obj->charge = 20;
X	    if (obj->plus == 0) obj->plus = mlevel;
X	  }
X	}
X	else mprint("I don't need your business, anyhow.");
X      }
X      else mprint("So nu?");
X    }
X    else if (response == ESCAPE) done = TRUE;
X  }
X  xredraw();
X}
X
Xvoid l_citygate()
X{
X  mprint("The huge gates are closed.");
X  mprint("you hear the howl of a chaos storm outside.");
X}
X
Xvoid l_chaosstorm()
X{
X  mprint("You are instantly reduced to a state of maximal entropy.");
X  p_death("a chaos storm");
X}
X  
X
X
Xvoid l_dpw()
X{
X  static int lastday = -10;
X  mprint("Rampart Department of Public Works.");
X  if (Date - lastday < 7)
X    printm("\nG'wan! Get a job!");
X  else if (Player.cash < 100) {
X    mprint("Do you want to go on the dole? [yn]");
X    if (ynq()=='y') {
X      mprint("Well, ok, but spend it wisely.");
X      mprint("Please enter your name for our records.");
X      if (strcmp(Player.name,msgscanstring()) != 0) {
X	mprint("Aha! Welfare Fraud! It's off to gaol for you, lout!");
X	send_to_jail();
X      }
X      else {
X	mprint("Here's your handout, layabout!");
X	lastday = Date;
X	Player.cash = 99;
X	dataprint();
X      }
X    }
X  }
X  else mprint("You're too well off for us to help you!");
X}
X
Xvoid l_library()
X{
X  char response;
X  int fee = 2000;
X  mprint("Rampart Public Library.");
X  if (nighttime())
X    mprint("CLOSED");
X  else {
X    morewait();
X    printm("\nLibrary Research Fee: 2000Au.");
X    if (Player.maxiq < 18) {
X      mprint("The Rampart student aid system has arranged a grant!");
X      mprint("Your revised fee is:");
X      mnumprint(fee=max(100,2000-(18-Player.maxiq)*250));
X      mprint("Au.");
X    }
X    mprint("Pay it? [yn]");
X    if (ynq()=='y') {
X      if (Player.cash < fee) 
X	mprint("No payee, No studee.");
X      else {
X	Player.cash -= fee;
X	menuclear();
X	menuprint("Peruse a scroll:\n");
X	menuprint("a: Omegan Theology\n");
X	menuprint("b: Guide to Rampart\n");
X	menuprint("c: Attempt Advanced Research\n");
X	do response = mgetc();
X	while ((response < 'a') || (response > 'c'));
X	if (response == 'a') {
X	  mprint("You unfurl an ancient, yellowing scroll...");
X	  morewait();
X	  theologyfile();
X	}
X	else if (response == 'b') {
X	  mprint("You unroll a slick four-color document...");
X	  morewait();
X	  cityguidefile();
X	}
X	else {
X	  if (random_range(30) > Player.iq)  {
X	    mprint("You feel more knowledgeable!");
X	    Player.maxiq++;
X	  }
X	  else {
X	    mprint("You find advice in an ancient tome:");
X	    hint();
X	  }
X	}
X      }
X      xredraw();
X    }
X    else mprint("You philistine!");
X  }
X}
X
X
Xvoid l_pawn_shop()
X{
X  static pob items[10];
X  static int lastitemgen = -1;
X  int i,j,done = FALSE;
X  char item,action;
X
X  if (nighttime())
X    mprint("Knight's Pawn Shop: Closed: Have a Nice (K)Night");
X  else {
X    if (lastitemgen < Date) {
X      for (i=0;i<10;i++) {
X	items[i] = create_object();
X	if (items[i] != NULL) {
X	  items[i]->known = 2;
X	  if (items[i]->objchar == CASH)
X	    items[i] = NULL;
X	}
X      }
X      lastitemgen = Date;
X    }
X    while (! done) {
X      mprint("\nKnight's Pawn Shop: Buy, Sell or Leave [b,s,ESCAPE] ");
X      menuclear();
X      for(i=0;i<10;i++) 
X	if (items[i] != NULL)
X	  menu_item_print(i,items[i]);
X      action = mgetc();
X      if (action == ESCAPE) 
X	done = TRUE;
X      else if (action == 'b') {
X	printm("\nPurchase which item? [ESCAPE to quit] ");
X	item = ' ';
X	while ((item != ESCAPE) &&
X	       ((item < 'a') || (item > 'k')))
X	  item = mgetc();
X	if (item != ESCAPE) {
X	  i = item - 'a';
X	  if (items[i] == NULL) mprint("No such item!");
X	  else {
X	    printm("\nThe low, low, cost is:");
X	    mnumprint(true_item_value(items[i]));
X	    mprint(" Buy it? [ynq] ");
X	    if (ynq() == 'y') {
X	      if (Player.cash < true_item_value(items[i]))
X		mprint("No credit! Gwan, Beat it!");
X	      else {
X		Player.cash -= true_item_value(items[i]);
X		Objects[items[i]->id].known = 1;
X		add_item_to_pack(items[i]);
X		items[i] = NULL;
X	      }
X	    }
X	  }
X	}
X      }
X      else if (action == 's') {
X	printm("\nSell which item");
X	i = getitem(NULL);
X	if ((i != ABORT) && (Player.possessions[i-'a'] != NULL)) {
X	  i -= 'a';
X	  if (Player.possessions[i]->used)
X	    mprint("You'll have to stop using it before you can sell it!");
X	  else {
X	    printm("\nYou can get ");
X	    mnumprint((int) (item_value(Player.possessions[i]) / 4));
X	    mprint(" gold pieces for it.");
X	    mprint("Sell?");
X	    if (ynq() == 'y') {
X	      Player.cash += ((int)(item_value(Player.possessions[i]) / 4));
X	      free((char *) items[0]);
X	      for(j=0;j<9;j++)
X		items[j] = items[j+1];
X	      items[9] = Player.possessions[i];
X	      items[9]->known = 2;	
X	      conform_lost_objects(1,Player.possessions[i]);
X	    }
X	  }
X	}
X      }
X      calc_melee();
X    }
X  }
X  xredraw();
X}
X
X
X
Xvoid l_cemetary()
X{
X  mprint("Rampart City Cemetary.");
X  mprint("Closed -- Full.");
X}
X
Xvoid l_condo()
X{
X  pol ol,prev=NULL;
X  int i,done=FALSE,over=FALSE,weeksleep=FALSE;
X  char response;
X
X  if (! Soldcondo) {
X    mprint("Rampart Arms.");
X    mprint("Weekly Rentals and Purchases");
X    mprint("Which are you interested in [r,p, or ESCAPE] ");
X    response = mgetc();
X    if (response == 'p') {
X      mprint("Only 50,000Au. Buy it? [yn] ");
X      if (ynq()=='y') {
X	if (Player.cash < 50000) 
X	  mprint("No mortgages, buddy.");
X	else {
X	  Soldcondo = TRUE;
X	  Player.cash-=50000;
X	  dataprint();
X	  mprint("You are the proud owner of a luxurious condo penthouse.");
X	  Condoitems = NULL;
X	}
X      }
X    }
X    else if (response == 'r') {
X      mprint("Weekly Rental, 1000Au. Pay for it? [yn] ");
X      if (ynq()=='y') {
X	if (Player.cash < 1000)
X	  mprint("Hey, pay the rent or out you go....");
X	else {
X	  weeksleep = TRUE;
X	  Player.cash -=1000;
X	  dataprint();
X	}
X      }
X    }
X    else mprint("Please keep us in mind for your housing needs.");
X  }
X  else {
X    while (! done) {
X      mprint("Home Sweet Home");
X      menuclear();
X      menuprint("a: Leave items in your safe.\n");
X      menuprint("b: Retrieve items.\n");
X      menuprint("c: Take a week off to rest.\n");
X      menuprint("d: Retire permanently.\n");
X      menuprint("ESCAPE: Leave this place.\n");
X      response = mgetc();
X      if (response == 'a') {
X	i = getitem(NULL);
X	if (i != ABORT) {
X	  if (Player.possessions[i-'a']->blessing < 0)
X	    mprint("The item just doesn't want to be stored away...");
X	  else {
X	    ol = ((pol) malloc(sizeof(oltype)));
X	    ol->thing = Player.possessions[i-'a'];
X	    ol->next = Condoitems;
X	    Condoitems = ol;
X	    conform_lost_object(Player.possessions[i-'a']);
X	  }
X	}
X      }
X      else if (response == 'b') {
X	ol = Condoitems;
X	while ((ol != NULL) && (! over)) {
X	  printm("\n Retrieve");
X	  printm(itemid(ol->thing));
X	  printm("[ynq]");
X	  response = mgetc();
X	  if (response == 'y') {
X	    add_item_to_pack(ol->thing);
X	    if (ol == Condoitems)
X	      Condoitems = Condoitems->next;
X	    else if (prev != NULL) prev->next = ol->next;
X	  }
X	  else if (response == 'q')
X	    over = TRUE;
X	  prev = ol;
X	  ol = ol->next;
X	}
X      }
X      else if (response == 'c') weeksleep = TRUE;
X      else if (response == 'd') {
X	mprint("You sure you want to retire, now? [yn]");
X	if (ynq() == 'y') {
X	  p_win();
X	}
X      }
X      else if (response == ESCAPE) done = TRUE;
X    }
X    xredraw();
X  }
X  if (weeksleep) {
X    mprint("Taking a week off to rest...");
X    Time+=100*24*7;
X    toggle_item_use(TRUE);
X    Player.hp = Player.maxhp;
X    Player.str = Player.maxstr;
X    Player.agi = Player.maxagi;
X    Player.con = Player.maxcon;
X    Player.dex = Player.maxdex;
X    Player.iq = Player.maxiq;
X    Player.pow = Player.maxpow;
X    toggle_item_use(FALSE);
X    Player.food = 23;
X    for (i=0;i<NUMSTATI;i++)
X      if (Player.status[i]<1000) Player.status[i]=0;
X    mprint("You're once again fit and ready to continue your adventure.");
X  }
X}
X
X
Xvoid l_residence()
X{
X  pob newitem;
X  if (Dungeon[Dlevel][Player.x][Player.y].aux == BURGLED) {
X    mprint("There is a city guard detachment on the scene here.");
X    mprint("You decide not to enter....");
X  }
X  else {
X    mprint("A private home.");
X    mprint("Burgle it?");
X    if (ynq()=='y') {
X      Player.alignment -= 2;
X      if (random_range(100) > Player.dex*3+Player.rank[THIEVES]*10) {
X	mprint("You set off the burglar alarm!");
X	mprint("The city guard shows up and carts you off to jail!");
X	send_to_jail();
X      }
X      else {
X	Dungeon[Dlevel][Player.x][Player.y].aux = BURGLED;
X	gain_experience(25);
X	mprint("You find some cash!");
X	Player.cash += random_range(500);
X	if (random_range(2) == 1) {
X	  mprint("You find a hidden cache! You find:");
X	  do {
X	    newitem = NULL;
X	    while (newitem == NULL)
X	      newitem = create_object();
X	    morewait();
X	    printm(itemid(newitem));
X	    add_item_to_pack(newitem);
X	  } while (random_range(3) == 1);
X	}
X      }
X    }
X    else mprint("Probably wise.");
X  }
X}
X
X
Xvoid gymtrain(maxstat,stat)
Xint *maxstat,*stat;
X{
X  if (*maxstat > *stat)
X    mprint("Training is useless while you are debilitated.");
X  else if (Gymcredit + Player.cash < 2000)
X    mprint("You can't afford our training!");
X  else {
X    if (Gymcredit > 2000) Gymcredit -= 2000;
X    else {
X      Player.cash -= (2000-Gymcredit);
X      Gymcredit = 0;
X    }
X    mprint("Sweat. Sweat.");
X    if (*maxstat < random_range(30)) {
X      mprint("The training pays off!");
X      (*maxstat)++;
X      (*stat)++;
X    }
X    else mprint("What a gyp! No improvement.");
X  }
X}
X
Xvoid healforpay()
X{
X  if (Player.cash < 50)
X    mprint("You can't afford to be healed!");
X  else {
X    Player.cash -= 50;
X    Player.hp += 20+random_range(20);
X    if (Player.hp > Player.maxhp) 
X      Player.hp = Player.maxhp;
X    mprint("Another medical marvel....");
X  }
X  calc_melee();
X}
X
Xvoid cureforpay()
X{
X  if (Player.cash < 250)
X    mprint("You can't afford to be cured!");
X  else {
X    Player.cash -= 250;
X    Player.status[DISEASED] = 0;
X    mprint("Quarantine lifted....");
X  }
X}  
X
X
X
Xvoid l_jail()
X{
X  mprint("Rampart City Gaol -- always room for more.");
X  mprint("You hear a loud 'click'");
X  Dungeon[0][Player.x][Player.y].locchar = CLOSED_DOOR;
X  Dungeon[0][Player.x][Player.y].aux = LOCKED;
X  Player.y--;
X  drawvision(Player.x,Player.y,Player.vision);
X}
X
Xvoid send_to_jail()
X{
X  int i,j,found=FALSE;
X  static int imprisonment=0;
X  switch(imprisonment++){
X  case 0:
X    mprint("The Justiciar sternly reprimands you.");
X    mprint("As a first-time offender, you are given probation.");
X    Dlevel = 0;
X    Player.y = 58;
X    Player.x = 40;
X    screencheck(58);
X    break;
X  default:
X    mprint("The guards recognize you as a 'three-time-loser'"); 
X    mprint("...and beat you up a little to teach you a lesson.");
X    p_damage(random_range(imprisonment * 10),UNSTOPPABLE,"police brutality");
X  case 1:
X    mprint("The Justiciar expresses his shame for your conduct.");
X    mprint("You are thrown in jail!");
X    Player.y = 55;
X    Player.x = 37 + (2*random_range(4));
X    Dlevel = 0;
X    screencheck(55);
X    l_jail();
X    break;
X  }
X}
X
Xvoid l_garden()
X{
X  mprint("Rampart Botanical Gardens---Do not deface statues.");
X}        
X
Xvoid l_challenge()
X{
X  mprint("A voice booms out, shaking the dungeon walls:");
X  mprint("'You have entered the Lairs of the Guardians'");
X}
X
Xvoid l_guardian()
X{
X  mprint("It seems the guardian of this key is away. What luck.");
X}
X
Xvoid l_adept()
X{
X  int i;
X  mprint("You see a giant shimmering gate.....");
X  mprint("Enter it? [yn]");
X  if (ynq()=='n') {
X    mprint("The Lords of Destiny spurn your cowardice....");
X    p_death("the Lords of Destiny");
X  }	
X  else {
X    mprint("Your head spins for a moment....");
X    drawomega();
X    mprint("and clears....");
X    mprint("You hear a voice boom:");
X    morewait();
X    printm("\nWelcome to the Adept's Challenge!");
X    mprint("A weird violet light illuminates you....");
X    for(i=0;i<MAXITEMS;i++)
X      if (Player.possessions[i]!=NULL)
X        conform_lost_object(Player.possessions[i]);
X    dispel(-1);
X    Player.hp = Player.maxhp;
X    Player.mana = calcmana();
X    mprint("You are naked, and alone.");
X    Player.x = 32;
X    Player.y = 36;
X  }
X}
X
Xvoid l_warning()
X{
X  mprint("A voice resounds throughout the dungeon....");
X  mprint("'Beware, O Adventurer, the final tests await!'");
X}
X
Xvoid l_final_abyss()
X{
X  mprint("You boldly enter the final abyss....");
X  mprint("You fall almost interminably.....");
X  sleep(10);
X  final_duel();
X}
X
X
Xvoid l_portcullis()
X{
X  mprint("You walk under a heavy portcullis.");
X}
X
Xvoid l_portcullis_trap()
X{
X  int i,j;
X  mprint("You hear heavy walls slamming down!");
X  for (i=0;i<WIDTH;i++)
X    for(j=0;j<LENGTH;j++) {
X      if (Dungeon[Dlevel][i][j].p_locf == L_PORTCULLIS)
X	Dungeon[Dlevel][i][j].locchar = WALL;
X      if (Dungeon[Dlevel][i][j].p_locf == L_PORTCULLIS_TRAP)
X	Dungeon[Dlevel][i][j].p_locf = L_NO_OP;
X    }
X}
X
Xvoid l_trifid()
X{
X  int i,damage=0,stuck=TRUE;
X  mprint("The hedge comes alive with a surge of alien growth!");
X  while (stuck) {
X    dataprint();
X    damage += Dlevel/2+1;
X    mprint("Razor-edged vines covered in suckers attach themselves to you.");
X    if ((i=inpack(THINGID+6,-1))+1) {
X      mprint("Thinking fast, you toss salt water on the trifid...");
X      mprint("The trifid disintegrates with a frustrated sigh.");
X      Dungeon[Dlevel][Player.x][Player.y].locchar = FLOOR;
X      Dungeon[Dlevel][Player.x][Player.y].p_locf = HEDGE;
X      gain_experience(1000);
X      stuck = FALSE;
X      conform_lost_objects(1,Player.possessions[i]);
X    }
X    else {
X      p_damage(damage,UNSTOPPABLE,"a trifid");
X      mprint("You are entangled in tendrils...");
X      menuclear();
X      menuprint("a: Try to break free.\n");
X      menuprint("b: Hang limp and hope the tendrils uncoil.\n");
X      menuprint("c: Pray for assistance.\n");
X      menuprint("d: Attempt to bargain with the hedge.\n");
X      menuprint("e: Click your heels together and wish for escape.\n");
X      menuprint("ANYTHING ELSE: writhe and scream hopelessly.\n");
X      switch(menugetc()) {
X      case 'a': 
X	if (Player.str > random_range(200)) {
X	  mprint("Amazing! You're now free.");
X	  mprint("The trifid writhes hungrily at you.");
X	  stuck = FALSE;
X	}
X	else mprint("Well, THAT didn't work.");
X	break;
X      case 'b': 
X	mprint("Well, at least you're facing your fate with dignity.");
X	break;
X      case 'c': 
X	mprint("You receive no divine aid as yet.");
X	break;
X      case 'd':
X	mprint("The hedge doesn't answer your entreaties.");
X	break;
X      case 'e':
X	mprint("You forgot your ruby slippers, stupid.");
X	break;
X      default:
X	mprint("The hedge enjoys your camp play-acting....");
X	break;
X      }
X    }
X  }
X  xredraw();
X}
X
X
Xvoid l_maze()
X{
X  mprint("Hedge maze closed for trifid extermination.");
X}
X
X
Xvoid l_vault()
X{
X  mprint("You come to a thick vault door with a complex time lock.");
X  if ((hour()==23)) {
X    mprint("The door is open.");
X    Dungeon[0][Player.x][Player.y+1].locchar = FLOOR;
X  }
X  else {
X    mprint("The door is closed.");
X    Dungeon[0][Player.x][Player.y+1].locchar = WALL;
X    mprint("Try to crack it? [yn]");
X    if (ynq()=='y') {
X      if (random_range(100) < Player.rank[THIEVES]*Player.rank[THIEVES]) {
X	mprint("The lock clicks open!!!");
X	gain_experience(5000);
X	Dungeon[0][Player.x][Player.y+1].locchar = FLOOR;
X      }	
X      else {
X	mprint("Uh, oh, set off the alarm.... The castle guard arrives....");
X	send_to_jail();
X      }
X    }
X    else mprint("Good move.");
X  }
X}
X
X
Xvoid l_brothel()
X{
X  char response;
X  mprint("You come to a heavily reinforced inner door.");
X  mprint("A sign reads `The House of the Eclipse'");
X  mprint("Try to enter? [yn]");
X  if (ynq()=='y') {
X    menuclear();
X    menuprint("a:knock on the door.\n");
X    menuprint("b:try to pick the lock.\n");
X    menuprint("c:bash down the door.\n");
X    menuprint("ESCAPE: Leave this house of ill repute.\n");
X    do 
X      response = menugetc();
X    while ((response != 'a') &&
X	   (response != 'b') &&
X	   (response != 'c') &&
X	   (response != ESCAPE));
X    xredraw();
X    if (response == 'a') {
X      if (!nighttime())
X	mprint("There is no reponse.");
X      else {
X	mprint("A window opens in the door.");
X	mprint("`500Au, buddy. For the night.' pay it [yn]?");
X	if (ynq()=='y') {
X	  if (Player.cash < 500) {
X	    mprint("`What, no roll?!'");
X	    mprint("The bouncer bounces you a little and lets you go.");
X	    p_damage(25,UNSTOPPABLE,"the bouncer");
X	  }
X	  else {
X	    Player.cash -= 500;
X	    mprint("You are ushered into an opulently appointed hall.");
X	    mprint("After an expensive dinner (takeout from Les Crapuleux)");
X	    mprint("you spend an enjoyable and educational evening with");
X	    if (Player.preference == 'm') 
X	      switch(random_range(4)) {
X	      case 0: 
X		mprint("Skarn the Insatiable, a satyr.");
X		break;
X	      case 1: 
X		mprint("Dryden the Defanged, an incubus.");
X		break;
X	      case 2: 
X		mprint("Gorgar the Equipped, a centaur.");
X		break;
X	      case 3: 
X		mprint("Hieronymus, the mendicant priest of Eros.");
X		break;
X	      }	
X	    else switch(random_range(4)) {
X	    case 0: 
X	      mprint("Noreen the Nymph (omaniac)");
X	      break;
X	    case 1: 
X	      mprint("Angelface, a recanted succubus.");
X	      break;
X	    case 2: 
X	      mprint("Corporal Sue of the City Guard (moonlighting).");
X	      break;
X	    case 3: 
X	      mprint("Sheena the Queena the Jungle, a wereleopard.");
X	      break;
X	    }	
X	    if (hour() > 12) Time += ((24-hour())+8) * 100;
X	    else Time += ((9-hour())*100);
X	    Player.food = 18;
X	    Player.status[DISEASED] = 0;
X	    /* reduce temporary stat gains to max stat levels */
X	    toggle_item_use(TRUE);
X	    Player.str = min(Player.str,Player.maxstr);
X	    Player.con = min(Player.con,Player.maxcon);
X	    Player.agi = min(Player.agi,Player.maxagi);
X	    Player.dex = min(Player.dex,Player.maxdex);
X	    Player.iq = min(Player.iq,Player.maxiq);
X	    Player.pow = min(Player.pow,Player.maxpow);
X	    toggle_item_use(FALSE);
X	    Player.con++;
X	    gain_experience(100);
X	    timeprint();
X	    dataprint();
X	    showflags();
X	    mprint("You arise, tired but happy, the next morning...");
X	  }
X	}
X	else mprint("What are you, some kinda prude?");
X      }
X    }
X    else if (response == 'b') {
X      if (nighttime()) {
X	mprint("As you fumble at the lock, the door opens....");
X	mprint("The bouncer tosses you into the street.");
X      }
X      else mprint("The door appears to be bolted and barred from behind.");
X    }
X    else if (response == 'c') {
X      if (nighttime()) {
X	mprint("As you charge toward the door it opens....");
X	mprint("Yaaaaah! Thud!");
X	mprint("You run passed the startled bouncer into a wall.");
X	p_damage(20,UNSTOPPABLE,"a move worthy of Clouseau");
X	mprint("The bouncer tosses you into the street.");
X      }
X      else {
X	mprint("Ouch! The door resists your efforts.");
X	p_damage(1,UNSTOPPABLE,"a sturdy door");
X	mprint("You hear an irritated voice from inside:");
X	mprint("'Keep it down out there! Some of us are trying to sleep!'");
X      }
X    }
X  }
X}
X
END_OF_osite.c
if test 41351 -ne `wc -c <osite.c`; then
    echo shar: \"osite.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 3 \(of 15\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 15 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0