forked from muspellsson/omega-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
site1.c
1093 lines (1055 loc) · 28.7 KB
/
site1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
/* site1.c */
/* 1st half of site functions and aux functions to them */
#include "glob.h"
#ifndef MSDOS_SUPPORTED_ANTIQUE
#include <unistd.h>
#endif
void l_armorer(void)
{
int done = FALSE;
char action;
if (hour() == 12)
print3("Unfortunately, this is Julie's lunch hour -- try again later.");
else if (nighttime())
print3("It seems that Julie keeps regular business hours.");
else {
while (! done) {
clearmsg();
print1("Julie's: Buy Armor, Weapons, or Leave [a,w,ESCAPE] ");
action = mgetc();
if (action == 'a')
buyfromstock(ARMORID,10);
else if (action == 'w')
buyfromstock(WEAPONID,23);
else
done = TRUE;
}
}
xredraw();
}
void buyfromstock(int base, int numitems)
{
int i;
char item;
pob newitem;
print2("Purchase which item? [ESCAPE to quit] ");
menuclear();
for(i=0;i<numitems;i++) {
strcpy(Str4," :");
Str4[0] = i + 'a';
strcat(Str4,Objects[base+i].objstr);
menuprint(Str4);
menuprint("\n");
}
showmenu();
item = ' ';
while ((item != ESCAPE) &&
((item < 'a') || (item >= 'a'+numitems)))
item = mgetc();
if (item != ESCAPE) {
i = item - 'a';
newitem = ((pob) checkmalloc(sizeof(objtype)));
*newitem = Objects[base+i];
newitem->known = 2;
clearmsg();
print1("I can let you have it for ");
mlongprint(2*true_item_value(newitem));
nprint1("Au. Buy it? [yn] ");
if (ynq1() == 'y') {
if (Player.cash < 2*true_item_value(newitem)) {
print2("Why not try again some time you have the cash?");
free_obj( newitem, TRUE );
}
else {
Player.cash -= 2*true_item_value(newitem);
dataprint();
gain_item(newitem);
}
}
else free_obj( newitem, TRUE );
}
}
void l_club(void)
{
char response;
print1("Rampart Explorers' Club.");
if (! gamestatusp(CLUB_MEMBER)) {
if (Player.level < 2) print3("Only reknowned adventurers need apply.");
else {
print2("Dues are 100Au. Pay it? [yn] ");
if (ynq2()=='y') {
if (Player.cash < 100)
print3("Beat it, or we'll blackball you!");
else {
print1("Welcome to the club! You are taught the spell of Return.");
print2("When cast on the first level of a dungeon it");
morewait();
clearmsg();
print1("will transport you down to the lowest level");
print2("you have explored, and vice versa.");
Spells[S_RETURN].known = TRUE;
Player.cash -= 100;
setgamestatus(CLUB_MEMBER);
}
}
else print2("OK, but you're missing out on our benefits....");
}
}
else {
print2("Shop at the club store or listen for rumors [sl] ");
do response = (char) mcigetc();
while ((response != 's') && (response != 'l') && (response != ESCAPE));
if (response == 'l') {
if (club_hinthour == hour()) print2("You don't hear anything useful.");
else {
print1("You overhear a conversation....");
hint();
club_hinthour = hour();
}
}
else if (response == 's') {
buyfromstock(OB_KEY,2);
xredraw();
}
else if (response == ESCAPE)
print2("Be seeing you, old chap!");
}
}
void l_gym(void)
{
int done=TRUE;
int trained=0;
clearmsg();
do {
print1("The Rampart Gymnasium");
if ((Gymcredit > 0) || (Player.rank[ARENA])) {
nprint1("-- Credit: ");
mlongprint(Gymcredit);
nprint1("Au.");
}
done = FALSE;
menuclear();
menuprint("Train for 2000 Au. Choose:\n");
menuprint("\na: work out in the weight room");
menuprint("\nb: use our gymnastics equipment");
menuprint("\nc: take our new anaerobics course");
menuprint("\nd: enroll in dance lessons.");
menuprint("\nESCAPE: Leave this place.");
showmenu();
switch(mgetc()) {
case 'a':
gymtrain(&(Player.maxstr),&(Player.str));
break;
case 'b':
gymtrain(&(Player.maxdex),&(Player.dex));
break;
case 'c':
gymtrain(&(Player.maxcon),&(Player.con));
break;
case 'd':
gymtrain(&(Player.maxagi),&(Player.agi));
break;
case ESCAPE:
clearmsg();
if (trained == 0)
print1("Well, it's your body you're depriving!");
else if (trained < 3)
print1("You towel yourself off, and find the exit.");
else
print1("A refreshing bath, and you're on your way.");
done = TRUE;
break;
default:
trained--;
break;
}
trained++;
} while (! done);
xredraw();
calc_melee();
}
void l_healer(void)
{
print1("Rampart Healers. Member RMA.");
morewait();
clearmsg();
print1("a: Heal injuries (50 crowns)");
print2("b: Cure disease (250 crowns)");
print3("ESCAPE: Leave these antiseptic alcoves.");
switch((char) mcigetc()) {
case 'a': healforpay(); break;
case 'b': cureforpay(); break;
default: print3("OK, but suppose you have Acute Satyriasis?"); break;
}
}
void statue_random(int x, int y)
{
pob item;
int i,j;
switch(random_range(difficulty()+4)-1) {
case 0:
case 1:
print1("The statue crumbles with a clatter of gravel.");
Level->site[x][y].locchar = RUBBLE;
Level->site[x][y].p_locf = L_RUBBLE;
plotspot(x, y, TRUE);
lset(x, y, CHANGED);
break;
case 2:
print1("The statue stoutly resists your attack.");
break;
case 3:
print1("The statue crumbles with a clatter of gravel.");
Level->site[x][y].locchar = RUBBLE;
Level->site[x][y].p_locf = L_RUBBLE;
plotspot(x, y, TRUE);
lset(x, y, CHANGED);
make_site_treasure(x,y,difficulty());
break;
case 4:
print1("The statue hits you back!");
p_damage(random_range(difficulty()*5),NORMAL_DAMAGE,"a statue");
break;
case 5:
print1("The statue looks slightly pained. It speaks:");
morewait();
clearmsg();
hint();
break;
case 6:
/* WDT MARK! Why is this testing for '==' city? Shouldn't
* it be '!='? */
/* DAG reply: no, == CITY is fine. A down staircase in Rampart is just
an alternate entrance to the sewers. But a down staircase elsewhere
(like a village) is not valid, so is prevented by this check */
if ( ((Current_Environment == Current_Dungeon) &&
(Level->depth < MaxDungeonLevels)) ||
(Current_Environment == E_CITY)) {
print1("You hear the whirr of some mechanism.");
print2("The statue glides smoothly into the floor!");
/* WDT HACK: I shouldn't be making this choice on a level
* where no stairs can be (or perhaps I should, and I should
* implement a bonus level!). */
/* DAG -- added level test above, to skip this case if at bottom
* might be cleaner to do something else... but this should prevent
* the chance of crashing at least. Maybe stairs up as first rev?*/
Level->site[x][y].locchar = STAIRS_DOWN;
Level->site[x][y].p_locf = L_NO_OP;
lset(x, y, CHANGED|STOPS);
}
break;
case 7:
print1("The statue was covered with contact cement!");
print2("You can't move....");
Player.status[IMMOBILE]+=random_range(6)+2;
break;
case 8:
print1("A strange radiation emanates from the statue!");
dispel(-1);
break;
case 9: /* I think this is particularly evil. Heh heh. */
if (Player.possessions[O_WEAPON_HAND] != NULL) {
print1("Your weapon sinks deeply into the statue and is sucked away!");
item = Player.possessions[O_WEAPON_HAND];
conform_lost_object(Player.possessions[O_WEAPON_HAND]);
item->blessing = -1-abs(item->blessing);
drop_at(x,y,item);
}
break;
case 10:
print1("The statue extends an arm. Beams of light illuminate the level!");
for(j=0;j<Level->level_length;j++)
for(i=0;i<Level->level_width;i++) {
lset(i,j,SEEN);
if (loc_statusp(i,j,SECRET)) {
lreset(i,j,SECRET);
lset(i,j,CHANGED);
}
}
show_screen();
break;
default:
l_statue_wake();
break;
}
}
void l_statue_wake(void)
{
int i;
int x=Player.x,y=Player.y;
for(i=0;i<9;i++)
wake_statue(x+Dirs[0][i],y+Dirs[1][i],TRUE);
}
void wake_statue(int x, int y, int first)
{
int i;
pml tml;
if (Level->site[x][y].locchar == STATUE) {
if (! first) mprint("Another statue awakens!");
else mprint("A statue springs to life!");
Level->site[x][y].locchar = FLOOR;
lset(x, y, CHANGED);
tml = ((pml) checkmalloc(sizeof(mltype)));
tml->m =
(Level->site[x][y].creature = m_create(x,y,0,difficulty()+1));
m_status_set(Level->site[x][y].creature,HOSTILE);
tml->next = Level->mlist;
Level->mlist = tml;
for(i=0;i<8;i++) wake_statue(x+Dirs[0][i],y+Dirs[1][i],FALSE);
}
}
void l_casino(void)
{
int i,done = FALSE,a,b,c,match;
char response;
print1("Rampart Mithril Nugget Casino.");
if (random_range(10)==1)
print2("Casino closed due to Grand Jury investigation.");
else {
while (! done) {
morewait();
clearmsg();
print1("a: Drop 100Au in the slots.");
print2("b: Risk 1000Au at roulette.");
print3("ESCAPE: Leave this green baize hall.");
response = (char) mcigetc();
if (response == 'a') {
if (Player.cash < 100) print3("No credit, jerk.");
else {
Player.cash -= 100;
dataprint();
for(i=0;i<20;i++) {
if (i==19)
sleep(1);
else
usleep(250000);
a = random_range(10);
b = random_range(10);
c = random_range(10);
clearmsg1();
mprint(slotstr(a));
mprint(slotstr(b));
mprint(slotstr(c));
}
if (winnings > 0) do {
a = random_range(10);
b = random_range(10);
c = random_range(10);
} while ((a==b) || (a == c) || (b == c));
else {
a = random_range(10);
b = random_range(10);
c = random_range(10);
}
clearmsg();
mprint(slotstr(a));
mprint(slotstr(b));
mprint(slotstr(c));
if ((a==b) && (a==c)) {
print3("Jackpot Winner!");
winnings += (a+2)*(b+2)*(c+2)*5;
Player.cash += (a+2)*(b+2)*(c+2)*5;
dataprint();
}
else if (a==b) {
print3("Winner!");
Player.cash += (a+2)*(b+2)*5;
dataprint();
winnings += (a+2)*(b+2)*5;
}
else if (a==c) {
print3("Winner!");
Player.cash += (a+2)*(c+2)*5;
dataprint();
winnings += (a+2)*(c+2)*5;
}
else if (c==b) {
print3("Winner!");
Player.cash += (c+2)*(b+2)*5;
dataprint();
winnings += (c+2)*(b+2)*5;
}
else {
print3("Loser!");
winnings -= 100;
}
}
}
else if (response == 'b') {
if (Player.cash < 1000) mprint("No credit, jerk.");
else {
Player.cash -= 1000;
dataprint();
print1("Red or Black? [rb]");
do response = (char) mcigetc();
while ((response != 'r') && (response != 'b'));
match = (response == 'r' ? 0 : 1);
for(i=0;i<20;i++) {
if (i==19)
sleep(1);
else
usleep(250000);
a = random_range(37);
b = a % 2;
if (a == 0) print1(" 0 ");
else if (a==1) print1(" 0 - 0 ");
else {
print1(( b == 0) ? "Red ": "Black ");
mnumprint(a-1);
}
}
if (winnings > 0) do {
a = random_range(37);
b = a % 2;
} while (b == match);
else {
a = random_range(37);
b = a % 2;
}
if (a == 0) print1(" 0 ");
else if (a==1) print1(" 0 - 0 ");
else {
print1((b == 0) ? "Red ": "Black ");
mnumprint(a-1);
}
if ((a > 1) && (b == match)){
print3(" Winner!");
winnings += 1000;
Player.cash += 2000;
dataprint();
}
else {
print3(" Loser!");
winnings -= 1000;
dataprint();
}
}
}
else done = TRUE;
}
}
}
void l_commandant (void)
{
int num;
pob food;
print1("Commandant Sonder's Rampart-fried Lyzzard partes. Open 24 hrs.");
print2("Buy a bucket! Only 5 Au. Make a purchase? [yn] ");
if ('y' == ynq2())
{
clearmsg();
num = (int)parsenum("How many?");
if (num < 1)
print3("Cute. Real cute.");
else if (num*5 > Player.cash)
print3("No handouts here, mac!");
else
{
Player.cash -= num*5;
food = (pob)checkmalloc(sizeof(objtype));
*food = Objects[OB_RATION]; /* food ration */
food->number = num;
if (1 == num)
print2("There you go, mac! One Lyzzard Bucket, coming up.");
else if (2 == num)
print2("Here you are! A couple of Lyzzard Buckets, steamin' hot.");
else
print2("A passel of Lyzzard Buckets, for your pleasure.");
morewait();
gain_item(food);
}
}
else print2("Don't blame the Commandant if you starve!");
}
void l_diner(void)
{
print1("The Rampart Diner. All you can eat, 25Au.");
print2("Place an order? [yn] ");
if (ynq2()=='y') {
if (Player.cash < 25)
mprint("TANSTAAFL! Now git!");
else {
Player.cash -= 25;
dataprint();
Player.food = 44;
foodcheck();
}
}
}
void l_crap(void)
{
print1("Les Crapeuleaux. (****) ");
if ((hour() < 17) || (hour() > 23))
print2 ("So sorry, we are closed 'til the morrow...");
else {
print2("May I take your order? [yn] ");
if (ynq2()=='y') {
if (Player.cash < 1000)
print2("So sorry, you have not the funds for dinner.");
else {
print2("Hope you enjoyed your tres expensive meal, m'sieur...");
Player.cash -= 1000;
dataprint();
Player.food += 8;
foodcheck();
}
}
}
}
void l_tavern(void)
{
char response;
print1("The Centaur and Nymph -- J. Riley, prop.");
if (nighttime()) {
menuclear();
menuprint("Riley says: Whataya have?\n\n");
menuprint("a: Pint of Riley's ultra-dark 1Au\n");
menuprint("b: Shot of Tullimore Dew 10Au\n");
menuprint("c: Round for the House. 100Au\n");
menuprint("d: Bed and Breakfast. 25Au\n");
menuprint("ESCAPE: Leave this comfortable haven.\n");
showmenu();
do response = (char) mcigetc();
while ((response != 'a') &&
(response != 'b') &&
(response != 'c') &&
(response != 'd') &&
(response != ESCAPE));
/* menuclear(); */
switch (response) {
case 'a':
if (Player.cash < 1)
print2("Aw hell, have one on me.");
else {
Player.cash -= 1;
Time += 10;
timeprint();
dataprint();
if (tavern_hinthour == -1) /* first time... */
{
print1("A seedy looking character approaches you.");
if (Player.rank[THIEVES] > 0 )
{
nprint1(" He appears to recognise you, somehow.");
if (! CitySiteList[L_BROTHEL-CITYSITEBASE][0])
{
print2("He nudge-nudges you, and says, 'You should visit the House of the Eclipse'");
CitySiteList[L_BROTHEL-CITYSITEBASE][0] = TRUE;
}
else
print2("He says, 'Did you enjoy your visit to the House of the Eclipse?', wink-wink.");
morewait();
}
else
{
print2("He offers to sell you some information for 10Au.");
nprint2("Do you pay him? [yn]");
if ( ynq2() == 'y' )
{
/*clearmsg();*/
if ( Player.cash < 10 )
{
print1("'You loser.'");
print2("He steals the rest of your money.");
Player.cash = 0;
}
else
{
Player.cash -= 10;
print1("He tells you how to find the thieves's guild");
print2("and how to find the House of the Eclipse.");
CitySiteList[L_BROTHEL-CITYSITEBASE][0] = TRUE;
CitySiteList[L_THIEVES_GUILD-CITYSITEBASE][0] = TRUE;
}
dataprint();
}
}
tavern_hinthour = hour();
} else /* not first time visit */
if (tavern_hinthour!=hour()) {
if (random_range(3)) {
print1("You overhear a rumor...");
hint();
}
else print1("You don't hear much of interest.");
tavern_hinthour = hour();
}
else print1("You just hear the same conversations again.");
}
Time += 20;
break;
case 'b':
if (Player.cash < 10)
print2("I don't serve the Dew on no tab, buddy!");
else {
Player.cash -= 10;
print1("Ahhhhh....");
if (Player.status[POISONED] || Player.status[DISEASED])
print2("Phew! That's, er, smooth stuff!");
Player.status[POISONED] = 0;
Player.status[DISEASED] = 0;
Time +=5;
showflags();
}
break;
case 'c':
if (Player.cash < 100) {
print1("Whatta feeb!");
print2("Outta my establishment.... Now!");
p_damage(random_range(20),UNSTOPPABLE,"Riley's right cross");
morewait();
}
else {
Player.cash -= 100;
dataprint();
print1("'What a guy!'"); morewait();
print2("'Hey, thanks, fella.'"); morewait();
print3("'Make mine a double...'"); morewait();
clearmsg();
switch(random_range(4)) {
case 0:
print1("'You're a real pal. Say, have you heard.... ");
hint();
break;
case 1:
print1("A wandering priest of Dionysus blesses you...");
if ((Player.patron == ODIN) || (Player.patron == ATHENA))
Player.alignment++;
else if ((Player.patron == HECATE) || (Player.patron == SET))
Player.alignment--;
else if (Player.alignment > 0) Player.alignment--;
else Player.alignment++;
break;
case 2:
print1("A thirsty bard promises to put your name in a song!");
gain_experience(20);
break;
case 3:
print1("Riley draws you a shot of his 'special reserve'");
print2("Drink it [yn]?");
if (ynq2()=='y') {
if (Player.con < random_range(20)) {
print1("<cough> Quite a kick!");
print2("You feel a fiery warmth in your tummy....");
Player.con++;
Player.maxcon++;
}
else print2("You toss it back nonchalantly.");
}
}
}
Time += 30;
break;
case 'd':
if (Player.cash < 25)
print2("Pay in advance, mac!");
else {
Player.cash -= 25;
print2("How about a shot o' the dew for a nightcap?");
morewait();
Time += (6+random_range(4)) * 60;
Player.status[POISONED] = 0;
Player.status[DISEASED] = 0;
Player.food = 40;
/* reduce temporary stat gains to max stat levels */
toggle_item_use(TRUE);
Player.str = min(Player.str,Player.maxstr);
Player.con = min(Player.con,Player.maxcon);
Player.agi = min(Player.agi,Player.maxagi);
Player.dex = min(Player.dex,Player.maxdex);
Player.iq = min(Player.iq,Player.maxiq);
Player.pow = min(Player.pow,Player.maxpow);
toggle_item_use(FALSE);
timeprint();
dataprint();
showflags();
print1("The next day.....");
if (hour() > 10) print2("Oh my! You overslept!");
}
break;
default:
print2("So? Just looking? Go on!");
break;
}
}
else print2("The pub don't open til dark, fella.");
xredraw();
}
void l_alchemist(void)
{
int i,done=FALSE,mlevel;
char response;
pob obj;
print1("Ambrosias' Potions et cie.");
if (nighttime())
print2("Ambrosias doesn't seem to be in right now.");
else while (! done){
morewait();
clearmsg();
print1("a: Sell monster components.");
print2("b: Pay for transformation.");
print3("ESCAPE: Leave this place.");
response = (char) mcigetc();
if (response == 'a') {
clearmsg();
done = TRUE;
i = getitem(CORPSE);
if ((i != ABORT) && (Player.possessions[i] != NULL)){
obj = Player.possessions[i];
if (Monsters[obj->charge].transformid == -1) {
print1("I don't want such a thing.");
if (obj->basevalue > 0)
print2("You might be able to sell it to someone else, though.");
}
else {
clearmsg();
print1("I'll give you ");
mnumprint(obj->basevalue/3);
nprint1("Au for it. Take it? [yn] ");
if (ynq1()=='y') {
Player.cash += (obj->basevalue/3);
conform_lost_objects(1,obj);
}
else print2("Well, keep the smelly old thing, then!");
}
}
else print2("So nu?");
}
else if (response == 'b') {
clearmsg();
done = TRUE;
i = getitem(CORPSE);
if ((i != ABORT) && (Player.possessions[i] != NULL)){
obj = Player.possessions[i];
if (Monsters[obj->charge].transformid == -1)
print1("Oy vey! You want me to transform such a thing?");
else {
mlevel = Monsters[obj->charge].level;
print1("It'll cost you ");
mnumprint(max(10,obj->basevalue*2));
nprint1("Au for the transformation. Pay it? [yn] ");
if (ynq1()=='y') {
if (Player.cash < max(10,obj->basevalue*2))
print2("You can't afford it!");
else {
print1("Voila! A tap of the Philosopher's Stone...");
Player.cash -= max(10,obj->basevalue*2);
*obj = Objects[Monsters[obj->charge].transformid];
if ((obj->id >= STICKID) && (obj->id < STICKID+NUMSTICKS))
obj->charge = 20;
if (obj->plus == 0) obj->plus = mlevel;
if (obj->blessing == 0) obj->blessing = 1;
}
}
else print2("I don't need your business, anyhow.");
}
}
else print2("So nu?");
}
else done = TRUE;
}
}
void l_dpw(void)
{
print1("Rampart Department of Public Works.");
if (Date - LastDay < 7)
print2("G'wan! Get a job!");
else if (Player.cash < 100)
{
morewait();
if ('y' == cinema_confirm("The clerk hands you government aid applications."))
{
print1("Well, ok, but spend it wisely.");
morewait();
print1("Please enter your name for our records:");
strcpy(Str1, msgscanstring());
if (Str1[0] >= 'a' && Str1[0] <= 'z')
Str1[0] += 'A' - 'a';
if (Str1[0] == '\0')
print1("Maybe you should come back when you've learned to write.");
else if (strcmp(Player.name,Str1) != 0)
{
print3("Aha! Welfare Fraud! It's off to gaol for you, lout!");
morewait();
send_to_jail();
}
else
{
print2("Here's your handout, layabout!");
LastDay = Date;
Player.cash = 99;
dataprint();
}
}
}
else print2("You're too well off for us to help you!");
}
void l_library(void)
{
char response;
int studied=FALSE;
int done=FALSE,fee = 1000;
print1("Rampart Public Library.");
if (nighttime())
print2("CLOSED");
else {
morewait();
print1("Library Research Fee: 1000Au.");
if (Player.maxiq < 18) {
print2("The Rampart student aid system has arranged a grant!");
morewait();
clearmsg();
print1("Your revised fee is: ");
mnumprint(fee=max(50,1000-(18-Player.maxiq)*125));
nprint1("Au.");
}
morewait();
while(! done) {
print1("Pay the fee? [yn] ");
if (ynq1()=='y') {
if (Player.cash < fee) {
print2("No payee, No studee.");
done = TRUE;
}
else {
Player.cash -= fee;
do {
studied = TRUE;
dataprint();
menuclear();
menuprint("Peruse a scroll:\n");
menuprint("a: Omegan Theology\n");
menuprint("b: Guide to Rampart\n");
menuprint("c: High Magick\n");
menuprint("d: Odd Uncatalogued Document\n");
menuprint("e: Attempt Advanced Research\n");
menuprint("ESCAPE: Leave this font of learning.\n");
showmenu();
response = (char) mcigetc();
if (response == 'a') {
print1("You unfurl an ancient, yellowing scroll...");
morewait();
theologyfile();
}
else if (response == 'b') {
print1("You unroll a slick four-color document...");
morewait();
cityguidefile();
}
else if (response == 'c') {
print1("This scroll is written in a strange magical script...");
morewait();
wishfile();
}
else if (response == 'd') {
print1("You find a strange document, obviously misfiled");
print2("under the heading 'acrylic fungus painting technique'");
morewait();
adeptfile();
}
else if (response == 'e') {
if (random_range(30) > Player.iq) {
print2("You feel more knowledgeable!");
Player.iq++;
Player.maxiq++;
dataprint();
if (Player.maxiq < 19 &&
fee != max(50,1000-(18-Player.maxiq)*125))
{
morewait();
clearmsg();
print1("Your revised fee is: ");
mnumprint(fee=max(50,1000-(18-Player.maxiq)*125));
nprint1("Au.");
morewait();
}
}
else {
clearmsg1();
print1("You find advice in an ancient tome: ");
morewait();
hint();
morewait();
}
}
else if (response == ESCAPE) {
done = TRUE;
print1("That was an expensive browse...");
}
else
studied = FALSE;
} while (!studied);
}
xredraw();
}
else {
done = TRUE;
if (studied)
print2("Come back anytime we're open, 7am to 8pm.");
else
print2("You philistine!");
}
}
}
}
void l_pawn_shop(void)
{
int i,j,k,limit,number,done = FALSE;
char item,action;
if (nighttime())
print1("Shop Closed: Have a Nice (K)Night");
else {
limit = min(5,Date-Pawndate);
Pawndate = Date;
for(k=0;k<limit;k++) {
if (Pawnitems[0] != NULL) {
if (Objects[Pawnitems[0]->id].uniqueness > UNIQUE_UNMADE)
Objects[Pawnitems[0]->id].uniqueness = UNIQUE_UNMADE;
/* could turn up anywhere, really :) */
free_obj( Pawnitems[0], TRUE );
Pawnitems[0] = NULL;
}
for (i=0;i<PAWNITEMS-1;i++)
Pawnitems[i] = Pawnitems[i+1];
Pawnitems[PAWNITEMS-1] = NULL;
for (i=0;i<PAWNITEMS;i++)
if (Pawnitems[i] == NULL)
do {
if (Pawnitems[i] != NULL)
free_obj( Pawnitems[i], TRUE );
Pawnitems[i] = create_object(5);
Pawnitems[i]->known = 2;
} while ((Pawnitems[i]->objchar == CASH) ||
(Pawnitems[i]->objchar == ARTIFACT) ||
(true_item_value(Pawnitems[i]) <= 0));
}
while (! done) {
print1("Knight's Pawn Shop:");
print2("Buy item, Sell item, sell Pack contents, Leave [b,s,p,ESCAPE] ");
menuclear();
for(i=0;i<PAWNITEMS;i++)
if (Pawnitems[i] != NULL) {
strcpy(Str3," :");
Str3[0] = i+'a';
strcat(Str3,itemid(Pawnitems[i]));
menuprint(Str3);
menuprint("\n");
}
showmenu();
action = (char) mcigetc();
if (action == ESCAPE)
done = TRUE;
else if (action == 'b') {
print2("Purchase which item? [ESCAPE to quit] ");
item = ' ';
while ((item != ESCAPE) &&
((item < 'a') || (item >= 'a' + PAWNITEMS)))
item = (char) mcigetc();
if (item != ESCAPE) {
i = item - 'a';
if (Pawnitems[i] == NULL) print3("No such item!");
else if (true_item_value(Pawnitems[i]) <= 0) {
print1("Hmm, how did that junk get on my shelves?");
print2("I'll just remove it.");
free_obj( Pawnitems[i], TRUE );
Pawnitems[i] = NULL;
}
else {
clearmsg();
print1("The low, low, cost is: ");
mlongprint(Pawnitems[i]->number*true_item_value(Pawnitems[i]));
nprint1(" Buy it? [ynq] ");