-+-+-+-+-+-+-+-+ START OF PART 42 -+-+-+-+-+-+-+-+ X lprc(i); /* echo the byte */ X i += dnditm - 'a'; X if (i>=MAXITM) outofstock(); else X if (itm`5Bi`5D.qty <= 0) outofstock(); else X if (pocketfull()) handsfull(); else X if (c`5BGOLD`5D < (long) itm`5Bi`5D.price * 10) nogold(); else X `7B X if (itm`5Bi`5D.mem != 0) *itm`5Bi`5D.mem`5Bitm`5Bi`5D.arg`5D = ' V '; X c`5BGOLD`5D -= (long) itm`5Bi`5D.price * 10; X itm`5Bi`5D.qty--; take(itm`5Bi`5D.obj,itm`5Bi`5D.arg); X if (itm`5Bi`5D.qty==0) dnditem(i); nap(1001); X `7D X `7D X X `7D X `7D X X/* X function for the players hands are full X */ Xstatic handsfull() X `7B lprcat("\nYou can't carry anything more!"); lflush(); nap(2200); `7D Xstatic outofstock() X `7B lprcat("\nSorry, but we are out of that item."); lflush(); nap(2200) V; `7D Xstatic nogold() X `7B lprcat("\nYou don't have enough gold to pay for that!"); lflush(); n Vap(2200); `7D X X/* X dnditem(index) X X to print the item list; used in dndstore() enter with the index into it Vm X */ Xstatic dnditem(i) X register int i; X `7B X register int j,k; X if (i >= MAXITM) return; X cursor( (j=(i&1)*40+1) , (k=((i%26)>>1)+5) ); X if (itm`5Bi`5D.qty == 0) `7B lprintf("%39s",""); return; `7D X lprintf("%c) ",(i%26)+'a'); X if (itm`5Bi`5D.obj == OPOTION) X `7B lprcat("potion of "); lprintf("%s",&potionname`5Bitm`5Bi`5D.arg` V5D`5B1`5D); `7D X else if (itm`5Bi`5D.obj == OSCROLL) X `7B lprcat("scroll of "); lprintf("%s",&scrollname`5Bitm`5Bi`5D.arg` V5D`5B1`5D); `7D X else lprintf("%s",objectname`5Bitm`5Bi`5D.obj`5D); X cursor( j+31,k ); lprintf("%6d", (long) itm`5Bi`5D.price * 10); X `7D X X`0C X/* X function to display the header info for the school X */ Xstatic sch_hed() X `7B X clear(); X lprcat("The College of Larn offers the exciting opportunity of higher ed Vucation to\n"); X lprcat("all inhabitants of the caves. Here is a list of the class sched Vule:\n\n\n"); X lprcat("\t\t Course Name \t Time Needed\n\n"); X X if (course`5B0`5D==0) lprcat("\t\ta) Fighters Training I 10 mob Vuls"); /*line 7 of crt*/ X lprc('\n'); X if (course`5B1`5D==0) lprcat("\t\tb) Fighters Training II 15 mob Vuls"); X lprc('\n'); X if (course`5B2`5D==0) lprcat("\t\tc) Introduction to Wizardry 10 mob Vuls"); X lprc('\n'); X if (course`5B3`5D==0) lprcat("\t\td) Applied Wizardry 20 mob Vuls"); X lprc('\n'); X if (course`5B4`5D==0) lprcat("\t\te) Behavioral Psychology 10 mob Vuls"); X lprc('\n'); X if (course`5B5`5D==0) lprcat("\t\tf) Faith for Today 10 mob Vuls"); X lprc('\n'); X if (course`5B6`5D==0) lprcat("\t\tg) Contemporary Dance 10 mob Vuls"); X lprc('\n'); X if (course`5B7`5D==0) lprcat("\t\th) History of Larn 5 mob Vuls"); X X lprcat("\n\n\t\tAll courses cost 250 gold pieces."); X cursor(30,18); X lprcat("You are presently carrying "); X `7D X Xoschool() X `7B X register int i; X long time_used; X nosignal = 1; /* disable signals */ X sch_hed(); X while (1) X `7B X cursor(57,18); lprintf("%d gold pieces. ",(long)c`5BGOLD`5D); curs Vors(); X lprcat("\nWhat is your choice `5B"); standout("escape"); X lprcat(" to leave`5D ? "); yrepcount=0; X i=0; while ((i<'a' `7C`7C i>'h') && (i!='\33') && (i!=12)) i=ttgetc Vh(); X if (i==12) `7B sch_hed(); continue; `7D X else if (i=='\33') X `7B nosignal = 0; drawscreen(); /* enable signals */ return; `7 VD X lprc(i); X if (c`5BGOLD`5D < 250) nogold(); else X if (course`5Bi-'a'`5D) X `7B lprcat("\nSorry, but that class is filled."); nap(1000); `7D X else X if (i <= 'h') X `7B X c`5BGOLD`5D -= 250; time_used=0; X switch(i) X `7B X case 'a': c`5BSTRENGTH`5D += 2; c`5BCONSTITUTION`5D++; X lprcat("\nYou feel stronger!"); X cl_line(16,7); X break; X X case 'b': if (course`5B0`5D==0) X `7B X lprcat("\nSorry, but this class has a prereq Vuisite of Fighters Training I"); X c`5BGOLD`5D+=250; time_used= -10000; break V; X `7D X lprcat("\nYou feel much stronger!"); X cl_line(16,8); X c`5BSTRENGTH`5D += 2; c`5BCONSTITUTION`5D += 2; V break; X X case 'c': c`5BINTELLIGENCE`5D += 2;`20 X lprcat("\nThe task before you now seems more att Vainable!"); X cl_line(16,9); break; X X case 'd': if (course`5B2`5D==0) X `7B X lprcat("\nSorry, but this class has a prereq Vuisite of Introduction to Wizardry"); X c`5BGOLD`5D+=250; time_used= -10000; break V; X `7D X lprcat("\nThe task before you now seems very att Vainable!"); X cl_line(16,10); X c`5BINTELLIGENCE`5D += 2; break; X X case 'e': c`5BCHARISMA`5D += 3; `20 X lprcat("\nYou now feel like a born leader!"); X cl_line(16,11); break; X X case 'f': c`5BWISDOM`5D += 2; `20 X lprcat("\nYou now feel more confident that you c Van find the potion in time!"); X cl_line(16,12); break; X X case 'g': c`5BDEXTERITY`5D += 3; `20 X lprcat("\nYou feel like dancing!"); X cl_line(16,13); break; X X case 'h': c`5BINTELLIGENCE`5D++; X lprcat("\nYour instructor told you that the Eye V of Larn is rumored to be guarded\n"); X lprcat("by a platinum dragon who possesses psion Vic abilities. "); X cl_line(16,14); break; X `7D X time_used += coursetime`5Bi-'a'`5D*100; X if (time_used > 0) X `7B X gtime += time_used; X course`5Bi-'a'`5D++; /* remember that he has taken that cour Vse */ X c`5BHP`5D = c`5BHPMAX`5D; c`5BSPELLS`5D = c`5BSPELLMAX`5D; /* V he regenerated */ X X if (c`5BBLINDCOUNT`5D) c`5BBLINDCOUNT`5D=1; /* cure blindn Vess too! */ X if (c`5BCONFUSE`5D) c`5BCONFUSE`5D=1; /* end confusio Vn */ X adjtime((long)time_used); /* adjust parameters for time change V */ X `7D X nap(1000); X `7D X `7D X `7D X`0C X/* X * for the first national bank of Larn X */ Xint lasttime=0; /* last time he was in bank */ Xobank() X `7B X banktitle(" Welcome to the First National Bank of Larn."); X `7D Xobank2() X `7B X banktitle("Welcome to the 5th level branch office of the First National V Bank of Larn."); X /* because we state the level in the title, clear the '?' in the X level display at the bottom, if the user teleported. X */ X c`5BTELEFLAG`5D = 0; X `7D Xstatic banktitle(str) X char *str; X `7B X nosignal = 1; /* disable signals */ X clear(); lprcat(str); X if (outstanding_taxes>0) X `7B X register int i; X lprcat("\n\nThe Larn Revenue Service has ordered that your account b Ve frozen until all\n"); beep(); X lprintf("levied taxes have been paid. They have also told us that y Vou owe %d gp in\n",(long)outstanding_taxes); X lprcat("taxes, and we must comply with them. We cannot serve you at V this time. Sorry.\n"); X lprcat("We suggest you go to the LRS office and pay your taxes.\n"); X cursors(); X lprcat("\nPress "); standout("escape"); lprcat(" to leave: "); lflus Vh(); X i=0; X while (i!='\33') i=ttgetch(); X drawscreen(); nosignal = 0; /* enable signals */ return; X `7D X lprcat("\n\n\tGemstone\t Appraisal\t\tGemstone\t Appraisal"); X obanksub(); nosignal = 0; /* enable signals */ X drawscreen(); X `7D X X/* X * function to put interest on your bank account X */ Xointerest() X `7B X register int i; X if (c`5BBANKACCOUNT`5D<0) c`5BBANKACCOUNT`5D = 0; X else if ((c`5BBANKACCOUNT`5D>0) && (c`5BBANKACCOUNT`5D<500000)) X `7B X i = (gtime-lasttime)/100; /* # mobuls elapsed */ X while ((i-- > 0) && (c`5BBANKACCOUNT`5D<500000)) X c`5BBANKACCOUNT`5D += c`5BBANKACCOUNT`5D/250; X if (c`5BBANKACCOUNT`5D>500000) c`5BBANKACCOUNT`5D=500000; /* interes Vt limit */ X `7D X lasttime = (gtime/100)*100; X `7D X Xstatic obanksub() X `7B X short gemorder`5B26`5D; /* the reference to screen location for each ge Vm */ X long gemvalue`5B26`5D; /* the appraisal of the gems */ X unsigned long amt; X register int i,k,gems_sold=0; X X ointerest(); /* credit any needed interest */ X X for (k=i=0; i<26; i++) X switch(iven`5Bi`5D) X `7B X case OLARNEYE: case ODIAMOND: case OEMERALD: X case ORUBY: case OSAPPHIRE: X X if (iven`5Bi`5D==OLARNEYE) X `7B X gemvalue`5Bi`5D=250000-((gtime*7)/100)*100; X if (gemvalue`5Bi`5D<50000) gemvalue`5Bi`5D=50000; X `7D X else gemvalue`5Bi`5D = (255&ivenarg`5Bi`5D)*100; X gemorder`5Bi`5D=k; X cursor( (k%2)*40+1 , (k>>1)+4 ); X lprintf("%c) %s",i+'a',objectname`5Biven`5Bi`5D`5D); X cursor( (k%2)*40+33 , (k>>1)+4 ); X lprintf("%5d",(long)gemvalue`5Bi`5D); k++; X break; X X default: /* make sure player can't sell non-existant gems V */ X gemvalue`5Bi`5D = 0 ; X gemorder`5Bi`5D = 0 ; X `7D; X cursor(31,17); lprintf("You have %8d gold pieces in the bank.",(long)c`5 VBBANKACCOUNT`5D); X cursor(40,18); lprintf("You have %8d gold pieces",(long)c`5BGOLD`5D); X if (c`5BBANKACCOUNT`5D+c`5BGOLD`5D >= 500000) X lprcat("\nNote: Larndom law states that only deposits under 500,000 Vgp can earn interest."); X while (1) X `7B X cl_dn(1,20); X lprcat("\nYour wish? `5B("); standout("d"); lprcat(") deposit, ("); X standout("w"); lprcat(") withdraw, ("); standout("s"); X lprcat(") sell a stone, or "); standout("escape"); lprcat("`5D "); X yrepcount=0; X i=0; while (i!='d' && i!='w' && i!='s' && i!='\33') i=ttgetch(); X switch(i) X `7B X# ifdef MSDOS X case 'd': X lprcat("deposit\n"); X cltoeoln(); X lprcat("How much? "); amt = readnum((long)c`5BGOLD`5D); X# else X case 'd': lprcat("deposit\nHow much? "); amt = readnum((long) Vc`5BGOLD`5D); X# endif X if (amt<0) `7B lprcat("\nSorry, but we can't take ne Vgative gold!"); nap(2000); amt=0; `7D else X if (amt>c`5BGOLD`5D) X `7B lprcat(" You don't have that much."); nap(20 V00); `7D X else `7B c`5BGOLD`5D -= amt; c`5BBANKACCOUNT`5D += V amt; `7D X break; X X case 'w': lprcat("withdraw\nHow much? "); amt = readnum((long) Vc`5BBANKACCOUNT`5D); X if (amt<0) `7B lprcat("\nSorry, but we don't have an Vy negative gold!"); nap(2000); amt=0; `7D X else if (amt > c`5BBANKACCOUNT`5D) X `7B lprcat("\nYou don't have that much in the bank V!"); nap(2000); `7D X else `7B c`5BGOLD`5D += amt; c`5BBANKACCOUNT`5D -= V amt; `7D X break; X X case 's': lprcat("\nWhich stone would you like to sell? "); X i=0; while ((i<'a' `7C`7C i>'z') && i!='*' && i!='\33') X i=ttgetch(); X if (i=='*') X `7B X for (i=0; i<26; i++) X `7B X if (gemvalue`5Bi`5D) X `7B X gems_sold = TRUE ; X c`5BGOLD`5D+=gemvalue`5Bi`5D; iven`5Bi`5D=0; X gemvalue`5Bi`5D=0; k = gemorder`5Bi`5D; X cursor( (k%2)*40+1 , (k>>1)+4 ); X lprintf("%39s",""); X `7D X `7D X if (!gems_sold) X `7B X lprcat("\nYou have no gems to sell!"); X nap(2000); X `7D X `7D X else if ( i != '\33' ) X `7B X if (gemvalue`5Bi=i-'a'`5D==0) X `7B X lprintf("\nItem %c is not a gemstone!",i+'a' V); X nap(2000); break; X `7D X c`5BGOLD`5D+=gemvalue`5Bi`5D; iven`5Bi`5D=0; X gemvalue`5Bi`5D=0; k = gemorder`5Bi`5D; X cursor( (k%2)*40+1 , (k>>1)+4 ); lprintf("%39s", V""); X `7D X break; X X case '\33': return; X `7D; X cursor(40,17); lprintf("%8d",(long)c`5BBANKACCOUNT`5D); X cursor(49,18); lprintf("%8d",(long)c`5BGOLD`5D); X `7D X `7D X X/* X function for the trading post X */ Xstatic otradhead() X `7B X clear(); X lprcat("Welcome to the Larn Trading Post. We buy items that explorers n Vo longer find\n"); X lprcat("useful. Since the condition of the items you bring in is not ce Vrtain,\n"); X lprcat("and we incur great expense in reconditioning the items, we usual Vly pay\n"); +-+-+-+-+-+-+-+- END OF PART 42 +-+-+-+-+-+-+-+-