-+-+-+-+-+-+-+-+ START OF PART 24 -+-+-+-+-+-+-+-+ X `7D X if (flag==0)`20 X lprcat("\nNo traps are visible"); X return; X X#if WIZID X case '_': /* this is the fudge player password for wizard mod Ve*/ X yrepcount=0; cursors(); nomove=1; X# ifndef MSDOS X if (userid!=wisid) X `7B X lprcat("Sorry, you are not empowered to be a wiz Vard.\n"); X scbr(); /* system("stty -echo cbreak"); */ X lflush(); return; X `7D X# endif X if (getpassword()==0) X `7B X scbr(); /* system("stty -echo cbreak"); */ retur Vn; X `7D X wizard=1; scbr(); /* system("stty -echo cbreak"); * V/ X for (i=0; i<6; i++) c`5Bi`5D=70; iven`5B0`5D=iven` V5B1`5D=0; X take(OPROTRING,50); take(OLANCE,25); c`5BWIELD`5D V=1; X c`5BLANCEDEATH`5D=1; c`5BWEAR`5D = c`5BSHIELD`5D = V -1; X raiseexperience(6000000L); c`5BAWARENESS`5D += 2500 V0; X `7B X register int i,j; X for (i=0; i2) /* no null items V */ X `7B item`5Bi`5D`5B0`5D=OSCROLL; iarg`5Bi`5D`5B0` V5D=i; `7D X for (i=MAXX-1; i>MAXX-1-MAXPOTION; i--) X if (strlen(potionname`5Bi-MAXX+MAXPOTION`5D)>2) /* V no null items */ X `7B item`5Bi`5D`5B0`5D=OPOTION; iarg`5Bi`5D`5B0` V5D=i-MAXX+MAXPOTION; `7D X for (i=1; i0) `7B if (c`5BHASTEMONST`5D) movemonst(); movemonst(); rand Vmonst(); regen(); `7D X if (hitflag) i=0; X if (i!=0) showcell(playerx,playery); X `7D X `7D X X/* X function to wield a weapon X */ Xstatic wield() X `7B X register int i; X while (1) X `7B X if ((i = whatitem("wield (- for nothing)")) == '\33') X return; X if (i != '.') X `7B X if (i=='*') X `7B X i = showwield(); X cursors(); X `7D X if ( i == '-' ) X `7B X c`5BWIELD`5D = -1 ; X bottomline(); X return; X `7D X if (i && i != '.') X if (iven`5Bi-'a'`5D==0) X `7B ydhi(i); return; `7D X else if (iven`5Bi-'a'`5D==OPOTION) X `7B ycwi(i); return; `7D X else if (iven`5Bi-'a'`5D==OSCROLL) X `7B ycwi(i); return; `7D X else if ((c`5BSHIELD`5D!= -1) && (iven`5Bi-'a'`5D==O2SWORD)) X `7B lprcat("\nBut one arm is busy with your shield!"); X return; `7D X else X `7B X c`5BWIELD`5D=i-'a'; X if (iven`5Bi-'a'`5D == OLANCE) X c`5BLANCEDEATH`5D=1; X else c`5BLANCEDEATH`5D=0; X bottomline(); X return; X `7D X `7D X `7D X `7D X X/* X common routine to say you don't have an item X */ Xstatic ydhi(x) X int x; X `7B cursors(); lprintf("\nYou don't have item %c!",x); `7D Xstatic ycwi(x) X int x; X `7B cursors(); lprintf("\nYou can't wield item %c!",x); `7D X X/* X function to wear armor X */ Xstatic wear() X `7B X register int i; X while (1) X `7B X if ((i = whatitem("wear"))=='\33') X return; X if (i != '.' && i != '-') X `7B X if (i=='*') X `7B X i = showwear(); X cursors(); X `7D X if (i && i != '.') X switch(iven`5Bi-'a'`5D) X `7B X case 0: X ydhi(i); X return; X case OLEATHER: case OCHAIN: case OPLATE: X case ORING: case OSPLINT: case OPLATEARMOR: X case OSTUDLEATHER: case OSSPLATE: X if (c`5BWEAR`5D != -1) `7B lprcat("\nYou're already V wearing some armor"); return; `7D X c`5BWEAR`5D=i-'a'; bottomline(); return; X case OSHIELD: if (c`5BSHIELD`5D != -1) `7B lprcat("\nY Vou are already wearing a shield"); return; `7D X if (iven`5Bc`5BWIELD`5D`5D==O2SWORD) `7B lpr Vcat("\nYour hands are busy with the two handed sword!"); return; `7D X c`5BSHIELD`5D = i-'a'; bottomline(); return V; X default: lprcat("\nYou can't wear that!"); X `7D; X `7D X `7D X `7D X X/* X function to drop an object X */ Xstatic dropobj() X `7B X register int i; X register char *p; X unsigned long amt; X X p = &item`5Bplayerx`5D`5Bplayery`5D; X while (1) X `7B X if ((i = whatitem("drop"))=='\33') X return; X if (i=='*') X `7B X i = showstr(TRUE); X cursors(); X `7D X if ( i != '-' ) X `7B X if (i=='.') /* drop some gold */ X `7B X if (*p) `7B lprcat("\nThere's something here already!"); ret Vurn; `7D X lprcat("\n\n"); X cl_dn(1,23); X lprcat("How much gold do you drop? "); X if ((amt=readnum((long)c`5BGOLD`5D)) == 0) return; X if (amt>c`5BGOLD`5D) X `7B X#ifdef MSDOS X lprcat("\n"); X#endif MSDOS X lprcat("You don't have that much!"); X return; `7D X if (amt<=32767) X `7B *p=OGOLDPILE; i=amt; `7D X else if (amt<=327670L) X `7B *p=ODGOLD; i=amt/10; amt = 10L*i; `7D X else if (amt<=3276700L) X `7B *p=OMAXGOLD; i=amt/100; amt = 100L*i; `7D X else if (amt<=32767000L) X `7B *p=OKGOLD; i=amt/1000; amt = 1000L*i; `7D X else X `7B *p=OKGOLD; i=32767; amt = 32767000L; `7D X c`5BGOLD`5D -= amt; X#ifndef MSDOS X lprintf("You drop %d gold pieces",(long)amt); X#else X lprintf("\nYou drop %d gold pieces",(long)amt); X#endif MSDOS X iarg`5Bplayerx`5D`5Bplayery`5D=i; bottomgold(); X know`5Bplayerx`5D`5Bplayery`5D=0; dropflag=1; return; X `7D X if (i) X `7B X drop_object(i-'a'); X return; X `7D X `7D X `7D X `7D X Xstatic int floor_consume( search_item, cons_verb ) Xint search_item; Xchar *cons_verb; X `7B X register int i; X char tempc; X X cursors(); X i = item`5Bplayerx`5D`5Bplayery`5D; X X /* item not there, quit X */ X if (i != search_item) X return( 0 ); X X /* item there. does the player want to consume it? X */ X lprintf("\nThere is %s", objectname`5Bi`5D ); X if (i==OSCROLL) X if (scrollname`5Biarg`5Bplayerx`5D`5Bplayery`5D`5D`5B0`5D) X lprintf(" of%s", scrollname`5Biarg`5Bplayerx`5D`5Bplayery`5D`5D) V; X if (i==OPOTION) X if (potionname`5Biarg`5Bplayerx`5D`5Bplayery`5D`5D`5B0`5D) X lprintf(" of%s", potionname`5Biarg`5Bplayerx`5D`5Bplayery`5D`5D) V; X lprintf(" here. Do you want to %s it?", cons_verb ); X X if ((tempc = getyn()) == 'n' ) X return( 0 ); /* item there, not consumed */ X else if (tempc != 'y') X `7B X lprcat(" aborted"); X return( -1 ); /* abort */ X `7D X X /* consume the item. X */ X switch( i ) X `7B X case OCOOKIE: X outfortune(); X forget(); X break; X case OBOOK: X readbook( iarg`5Bplayerx`5D`5Bplayery`5D ); X forget(); X break; X case OPOTION: X quaffpotion( iarg`5Bplayerx`5D`5Bplayery`5D ); X forget(); X break; X case OSCROLL: X /* scrolls are tricky because of teleport. X */ X i = iarg`5Bplayerx`5D`5Bplayery`5D; X know`5Bplayerx`5D`5Bplayery`5D = 0; X item`5Bplayerx`5D`5Bplayery`5D = iarg`5Bplayerx`5D`5Bplayery`5D V = 0 ; X read_scroll( i ); X break; X `7D X return( 1 ); X `7D X Xstatic int consume( search_item, prompt, showfunc ) Xint search_item ; Xchar *prompt; Xint (*showfunc)(); X `7B X register int i; X X while (1) X `7B X if ((i = whatitem( prompt )) == '\33') X return; X if (i != '.' && i != '-') X `7B X if (i == '*') X `7B X i = showfunc(); X cursors(); X `7D X if (i && i != '.') X `7B X switch (iven`5Bi-'a'`5D) X `7B X case OSCROLL: X if ( search_item != OSCROLL ) X `7B X lprintf("\nYou can't %s that.", prompt ); X return; X `7D X read_scroll( ivenarg`5Bi-'a'`5D ); X break; X case OBOOK: X if ( search_item != OSCROLL ) X `7B X lprintf("\nYou can't %s that.", prompt ); X return; X `7D X readbook( ivenarg`5Bi-'a'`5D ); X break; X case OCOOKIE: X if ( search_item != OCOOKIE ) X `7B X lprintf("\nYou can't %s that.", prompt ); X return; X `7D X outfortune(); X break; X case OPOTION: X if ( search_item != OPOTION ) X `7B X lprintf("\nYou can't %s that.", prompt ); X return; X `7D X quaffpotion( ivenarg`5Bi-'a'`5D, TRUE ); X break; X case 0: X ydhi(i); X return; X default: X lprintf("\nYou can't %s that.", prompt ); X return; X `7D X iven`5Bi-'a'`5D = 0; X return; X `7D X `7D X `7D X `7D X X/* X function to ask what player wants to do X */ Xstatic whatitem(str) X char *str; X `7B X int i=0; X cursors(); lprintf("\nWhat do you want to %s `5B* for all`5D ? ",str); X while (i>'z' `7C`7C (i<'a' && i!='-' && i!='*' && i!='\33' && i!='.')) X i=ttgetch(); X if (i=='\33') X lprcat(" aborted"); X return(i); X `7D X X/* X subroutine to get a number from the player X and allow * to mean return amt, else return the number entered X */ Xunsigned long readnum(mx) X long mx; X `7B X register int i; X register unsigned long amt=0; X X sncbr(); X /* allow him to say * for all gold`20 X */ X if ((i=ttgetch()) == '*') X amt = mx; X else X /* read chars into buffer, deleting when requested */ X while (i != '\n') X `7B X if (i=='\033') `7B scbr(); lprcat(" aborted"); return(0); `7D X if ((i <= '9') && (i >= '0') && (amt<999999999)) X amt = amt*10+i-'0'; X if ((i=='\010') `7C`7C (i=='\177')) X amt = (long)(amt / 10) ; X i = ttgetch(); X `7D X scbr(); X return(amt); X `7D X X#ifdef HIDEBYLINK X/* X * routine to zero every byte in a string X */ Xszero(str) X register char *str; X `7B X while (*str) X *str++ = 0; X `7D X#endif HIDEBYLINK X X#ifdef TIMECHECK X/* X * routine to check the time of day and return 1 if its during work hours X * checks the file ".holidays" for forms like "mmm dd comment..." X */ Xint playable() X `7B X long g_time,time(); X int hour,day,year; X char *date,*month,*p; X X time(&g_time); /* get the time and date */ X date = ctime(&g_time); /* format: Fri Jul 4 00:27:56 EDT 1986 */ X year = atoi(date+20); X hour = (date`5B11`5D-'0')*10 + date`5B12`5D-'0'; X day = (date`5B8`5D!=' ') ? ((date`5B8`5D-'0')*10 + date`5B9`5D-'0') : ( Vdate`5B9`5D-'0'); +-+-+-+-+-+-+-+- END OF PART 24 +-+-+-+-+-+-+-+-