-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMILEDIT.PAS
1837 lines (1772 loc) · 64 KB
/
MILEDIT.PAS
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
Type
ParmType = (DFlag, DNum, DWord, DOther);
Parameter = Packed Record
PName: Ch2;
PType: ParmType
End (*Parameter*);
PType = Packed Array [1..42] of Parameter;
Var
Parms : PType;
Function GetEditParm (Var ParmL : PType; LPList: Integer;
Var Word: Alfa; Var Num : Integer;
Var Flag : Boolean; Var Buffer : BufType;
Var LenBuf: LenBufType;
Var Loc : Integer) : Integer; Forward;
Procedure Add (N : Integer; P : Ch2; T : ParmType); Forward;
Procedure AssocErr; Forward;
Procedure ModPlayer (Var Player: UserPoint; OnLine: Boolean);
Var
NP, ILoop, WhichParm, Number: Integer;
Ch: Char;
Word: Alfa;
Flag: Boolean;
Index: Integer;
Procedure InitUsrParms;
Begin
Add (1, 'NA', DWord);
Add (2, 'ZZ', DWord);
Add (3, 'WE', DNum);
Add (4, 'LV', DNum);
Add (5, 'CL', DWord);
Add (6, 'VI', DNum);
Add (7, 'MV', DNum);
Add (8, 'MA', DNum);
Add (9, 'MM', DNum);
Add (10, 'EX', DNum);
Add (11, 'AC', DNum);
Add (12, 'RO', DNum);
Add (13, 'BR', DFlag);
Add (14, 'ST', DNum);
Add (15, 'IN', DNum);
Add (16, 'DX', DNum);
Add (17, 'PT', DNum);
Add (18, 'EC', DFlag);
Add (19, 'CO', DNum);
Add (20, 'SE', DWord);
Add (21, 'xx', DNum);
Add (22, 'PW', DWord);
Add (23, 'MO', DNum);
Add (24, 'LA', DNum);
Add (25, 'IV', DFlag);
Add (26, 'FA', DNum);
Add (27, 'MF', DNum);
Add (28, 'PO', DFlag);
Add (29, 'PL', DFlag);
Add (30, 'HD', DFlag);
Add (31, 'TG', DFlag);
Add (32, 'MB', DFlag);
Add (33, 'AG', DFlag);
Add (34, 'EV', DFlag);
Add (35, 'SL', DNum);
Add (36, 'TL', DNum);
Add (37, 'NO', DFlag);
Add (38, 'SS', DNum);
Add (39, 'TS', DNum);
Add (40, 'BS', DNum);
Add (41, 'PS', DNum)
End (*InitUsrParms*);
Begin
InitUsrParms;
NP := 0;
WhichParm := GetEditParm (Parms, 41, Word, Number, Flag,
Buffer, LenBuf, Loc);
While WhichParm > 0 Do
With Player ^ Do
Begin
NP := NP + 1;
If User ^.Assoc And (WhichParm in [3,11,20,21,25,29,34,37])
Then
Begin
Writev (B1, '0',
Parms[WhichParm].PName, ' - Illegal access.');
QOut (Term, B1);
AssocErr;
Loc := LenBuf + 1
End (*If*)
Else
Case WhichParm of
1:
Name := Word;
2:
If Not User ^.Master
Then
QOut (Term,
'0Only master DMs may activate DM priviledges.')
Else
Begin
Ch := Cap (Word [1]);
If Ch in ['D', 'A', 'M', 'N']
Then
Case Ch of
'D':
Begin
SSJ := True;
Assoc := False;
Master := False
End (*'D'*);
'A':
Begin
SSJ := True;
Assoc := True;
Master := False
End (*'A'*);
'M':
Begin
SSJ := True;
Assoc := False;
Master := True
End (*'M'*);
'N':
Begin
SSJ := False;
Assoc := False;
Master := False
End (*'N'*)
End (*Case*)
Else
QOut (Term,
'0Error. ZZ must = None, Assistant, DM or Master.')
End (*Else*);
3:
Weight := Max (0, Min (5000, Number));
4:
Lvl := Max (0, Min (25, Number));
5:
Begin
Ch := Cap (Word [1]);
If Ch in ['B', 'F', 'T', 'C', 'M', 'R', 'P', 'D']
Then
Case Ch of
'B':
Class := Barbarian;
'F':
Class := Fighter;
'T':
Class := Thief;
'C':
Class := Cleric;
'M':
Class := MagicUser;
'R':
Class := Ranger;
'P':
Class := Paladin;
'D':
Class := DM
End (*Case*)
Else
QOut (Term, '0Illegal class type.')
End (*5*);
6:
Hits := Max (0, Min (2500, Number));
7:
MaxHits := Max (0, Min (2500, Number));
8:
Magic := Max (0, Min (2500, Number));
9:
MaxMagic := Max (0, Min (2500, Number));
10:
Begin
Number := Max (0, Min (MaxInt, Number));
Experience := Number
End (*10*);
11:
AC := Max (-32, Min (31, Number));
12:
If OnLine Then
Begin
DeletePlayer (Player, RmCode);
PlacePlayer (Player, Number)
End (*If*)
Else
RmCode := Number;
13:
Brief := Flag;
14:
Str := Max (-10, Min (25, Number));
15:
Int := Max (-10, Min (25, Number));
16:
Dex := Max (-10, Min (25, Number));
17:
Pty := Max (-10, Min (25, Number));
18:
Echo := Flag;
19:
Con := Max (-10, Min (25, Number));
20:
Begin
Word [1] := Cap (Word [1]);
If Word [1] = 'M'
Then
Sex := Male
Else
If Word [1] = 'F'
Then
Sex := Female
Else
QOut (Term, '0Sex must be male or female.')
End (*20*);
22:
If User ^.Master
Then
Begin
CapAlfa (Word);
PW := Hash (Word, 10)
End (*If*)
Else
QOut (Term, '0Only master DMs may alter passwords.');
23:
Begin
Number := Max (0, Min (MaxInt, Number));
Money := Number
End (*23*);
24:
LastAccess := Max (0, Min (31, Number));
25:
Invisible := Flag;
26:
Fatigue := Max (0, Min (2500, Number));
27:
MaxFatigue := Max (0, Min (2500, Number));
28:
Poisoned := Flag;
29:
Playtester := Flag;
30:
Hidden := Flag;
31:
TGuild := Flag;
32:
MesBlock := Flag;
33:
AGuild := Flag;
34:
Evil := Flag;
35:
SpellDay := Max (0, Min (5, Number));
36:
SendDay := Max (0, Min (31, Number));
37:
Nonexistant := Flag;
38:
SSharp := Min (7, Max (0, Number Div 10));
39:
SThrust := Min (7, Max (0, Number Div 10));
40:
SBlunt := Min (7, Max (0, Number Div 10));
41:
SLong := Min (7, Max (0, Number Div 10));
End (*Case*);
WhichParm := GetEditParm (Parms, 41, Word, Number, Flag,
Buffer, LenBuf, Loc);
End (*While*);
If NP > 0
Then
QOut (Term, '0Player modified.')
End (*ModPlayer*);
Procedure EditPlayer (EditCmd: Integer; Which: Alfa);
Var
Player: UserPoint;
Begin
Player := NIL;
If EditCmd = 4
Then
QOut (Term, '0You can''t create players.')
Else
Begin
Player := FindUser (Which, UserTail);
If Player = NIL
Then
QOut (Term, '0Player not found.')
Else
Case EditCmd of
1:
ModPlayer (Player, True);
2:
If User ^.Assoc
Then
AssocErr
Else
Begin
Ps (Player^.Name, B1);
B1 := '0### A lightning bolt hits ' + B1;
Writev (B2, ' and turns ', Pro [Player^.Sex],
' into ashes!');
B1 := B1 + B2;
For ILoop := 1 to MsgTerm (TermList, SysMsg) Do
QOut (TermList [ILoop], B1);
Player ^.Dead := True;
Player ^.Hits := 0
End (*Else*);
3:
PlayerDisplay (Player)
End (*Case*)
End (*Else*)
End (*EditPlayer*);
Procedure EditFile (EditCmd: Integer; Which: Alfa);
Var
Player: UserPoint;
Exists: Boolean;
Begin
Exists := True;
ReadPlayer (Player, Which);
If Player ^.Name = Empty Then
Begin
QOut (Term, '0Entry not found.');
Exists := False;
Player ^.Name := Which
End (*If*);
Case EditCmd of
1: (*Modify*)
Begin
ModPlayer (Player, False);
WritePlayer (Player, True);
WritePlayer (Player, False)
End (*If*);
2: (*Dispose*)
If Exists
Then
Begin
DeleteUsr (Player ^.Name);
WritePlayer (Player, False);
QOut (Term, '0Player erased.')
End (*If*)
Else
WritePlayer (Player, False);
3:
Begin
If Exists Then
PlayerDisplay (Player);
WritePlayer (Player, False)
End (*3*);
4:
If Not Exists
Then
Begin
Player ^.LastAccess := 1;
QOut (Term, '0Entry created.');
ModPlayer (Player, False);
WritePlayer (Player, True);
WritePlayer (Player, False)
End (*If*)
Else
Begin
QOut (Term, '0Player already exists in file.');
WritePlayer (Player, False)
End (*Else*)
End (*Case*)
End (*EditFile*);
Procedure EditRoom (EditCmd: Integer; Rm: Integer);
Var
NP, N, ILoop, WhichParm, Number: Integer;
Word: Alfa;
Flag: Boolean;
Procedure InitRoom;
Begin
Add (1, 'DI', DNum);
Add (2, 'DR', DNum);
Add (3, 'N ', DNum);
Add (4, 'S ', DNum);
Add (5, 'E ', DNum);
Add (6, 'W ', DNum);
Add (7, 'U ', DNum);
Add (8, 'D ', DNum);
Add (9, 'OU', DNum);
Add (10, 'EN', DNum);
Add (11, 'ET', DNum);
Add (12, 'NO', DFlag);
Add (13, 'SA', DFlag)
End (*InitRoom*);
Begin
InitRoom;
If (Rm <= 0) Or (Rm > NumRooms)
Then
QOut (Term, '0Room number out of bounds.')
Else
Case EditCmd of
1:
Begin
Rm := S (Rm);
NP := 0;
WhichParm := GetEditParm (Parms, 13, Word, Number, Flag,
Buffer, LenBuf, Loc);
While WhichParm > 0 Do
With Room [Rm] Do
Begin
NP := NP + 1;
Case WhichParm of
1:
DescCode := Max (0, Min (StrPerSeg, Number));
2:
DescRec := Max (0, Min (256, Number));
3, 4, 5, 6, 7, 8:
Begin
Number := Max (0, Min (NumRooms, Number));
Adjoin [WhichParm - 2] := Number
End (*Else*);
9:
Out := Max (0, Min (NumRooms, Number));
10:
WhichEncounter := Max (0, Min (Lencounter, Number));
11:
EncounterTime := Max (0, Min (255, Number));
12:
NotifyDm := Flag;
13:
Safe := Flag
End (*Case*);
WhichParm := GetEditParm (Parms, 13, Word, Number, Flag,
Buffer, LenBuf, Loc)
End (*While*);
If NP > 0
Then
QOut (Term, '0Room modified.')
End (*1*);
2:
Begin
Rm := S (Rm);
Room [Rm] := ProtoRoom;
QOut (Term, '0Room initialized.');
End;
3:
Begin
Rm := S (Rm);
RoomDisplay (Rm, User ^.Brief);
With Room [Rm] Do
Begin
B1 := '0';
For ILoop := 1 to 6 Do
Begin
Writev (B2, Cap (DirList [ILoop, 1]), '=',
Adjoin [ILoop]: 0, ', ');
B1 := B1 + B2
End (*For*);
If Out > 0
Then
Begin
Writev (B2, 'OUT=', Out: 0, ', ');
B1 := B1 + B2
End (*If*);
Writev (B2, 'DR=', DescRec: 0, ', DI=', DescCode: 0,
', EN=', WhichEncounter: 0,
', ET=', EncounterTime: 0, '.');
B1 := B1 + B2;
QOut (Term, B1);
If NotifyDm Then
QOut (Term, '0Dm notified upon entry.');
If Safe Then
QOut (Term, '0Room is haven against attack.')
End (*With*)
End (*3*);
4:
If Not User ^.Master
Then
QOut (Term,
'0Sorry, only master DMs may create additional roomsegs.')
Else
AddSeg
End (*Case*)
End (*EditRoom*);
Procedure EditMonster (EditCmd: Integer; Which: Alfa;
MNum, Whatcode: Integer);
Var
Monster: MonsterPoint;
Object: ObjectPoint;
NP, WhichParm, Number, Rm: Integer;
Dummy, Word: Alfa;
Flag: Boolean;
Procedure InitMon;
Begin
Add (1, 'DE', DFlag);
Add (2, 'BL', DFlag);
Add (3, 'FO', DFlag);
Add (4, 'GU', DFlag);
Add (5, 'AT', DFlag);
Add (6, 'SR', DFlag);
Add (7, 'MO', DFlag);
Add (8, 'FL', DFlag);
Add (9, 'AS', DFlag);
Add (10, 'LV', DNum);
Add (11, 'HI', DNum);
Add (12, 'MH', DNum);
Add (13, 'EX', DNum);
Add (14, 'PE', DFlag);
Add (15, 'MA', DFlag);
Add (16, 'TR', DNum);
Add (17, 'NA', DWord);
Add (18, 'FR', DFlag);
Add (19, 'IN', DFlag);
Add (20, 'RE', DFlag);
Add (21, 'DR', DFlag);
Add (22, 'PO', DFlag);
Add (23, 'AM', DFlag);
Add (24, 'UN', DFlag);
Add (25, 'SP', DFlag);
Add (26, 'PA', DNum);
End (*InitMon*);
Begin
If WhatCode = 10
Then
GetWord (Dummy, Rm, Buffer, LenBuf, Loc)
Else
Begin
Rm := MNum;
Dummy := Which
End (*Else*);
If (Rm <= 0) or (Rm > NumRooms) Or (Dummy <> Blanks)
Then
QOut (Term, '0Illegal location number.')
Else
Begin
If WhatCode = 10
Then
Begin
Rm := S (Rm);
Monster := FindMonster (Which, MNum, Room[Rm].RmMonsterTail);
If EditCmd = 4
Then
Begin
New (Monster);
Monster ^ := ProtoMonster;
Monster ^.Name := Which;
InsertMonster (Monster, Rm);
QOut (Term, '0Monster created.')
End (*If*)
End (*If*)
Else
If (Rm >= 1) And (Rm <= RanMonLen)
Then
Begin
New (Monster);
Find (MList, Rm);
Monster ^ := MList ^
End (*If*)
Else
Begin
QOut (Term, '0Bad MList number.');
WhichParm := 0;
Monster := NIL
End (*Else*);
If Monster <> NIL
Then
Case EditCmd of
1,4 (*Modify, create*):
With Monster ^ Do
Begin
InitMon;
NP := 0;
WhichParm := GetEditParm (Parms, 26, Word, Number, Flag,
Buffer, LenBuf, Loc);
While WhichParm > 0 Do
Begin
If (WhatCode = 13) And User ^.Assoc
Then
Begin
AssocErr;
Loc := LenBuf + 1
End (*If*)
Else
Begin
NP := NP + 1;
Case WhichParm of
1:
Defend := Flag;
2:
Block := Flag;
3:
Follow := Flag;
4:
Guard := Flag;
5:
AtkLastAggr := Flag;
6:
SlowReact := Flag;
7:
MoralReact := Flag;
8:
Flee := Flag;
9:
Assistance := Flag;
10:
Lvl := Max (0, Min (25, Number));
11:
Hits := Max (0, Min (2500, Number));
12:
MaxHits := Max (0, Min (2500, Number));
13:
Experience := Max (0, Min (MaxInt, Number));
14:
Permanent := Flag;
15:
Magic := Flag;
16:
WhichObj := Max (0, Min (Number, ObjListLen));
17:
Name := Word;
18:
FastReact := Flag;
19:
Invisible := Flag;
20:
Regenerate := Flag;
21:
Drain := Flag;
22:
Poison := Flag;
23:
AntiMagic := Flag;
24:
Undead := Flag;
25:
MonSpells := Flag;
26:
MParley := Max (0, Min (30, Number))
End (*Case*)
End (*Else*);
WhichParm := GetEditParm (Parms, 26, Word, Number,
Flag, Buffer, LenBuf, Loc)
End (*While*);
If MaxHits < Hits
Then
MaxHits := Hits;
If NP > 0
Then
QOut (Term, '0Monster modified.')
End (*1*);
2 (*Dispose*):
If WhatCode = 10
Then
Begin
DeleteMonster (Monster, Rm);
Destroy (Monster);
QOut (Term, '0Monster disposed.')
End (*If*)
Else
QOut (Term, '0MList cannot be disposed.');
3 (*Display*):
MonDisplay (Monster)
End (*Case*)
Else
QOut (Term, '0Monster not found.');
If (WhatCode = 13) And (Monster <> NIL)
Then
Begin
Locate (MList, Rm);
MList ^ := Monster ^;
Put (MList);
Reset (MList);
Dispose (Monster)
End (*If*)
End (*Else*)
End (*EditMonster*);
Procedure ModObject (Object: ObjectPoint);
Var
NP, WhichParm, Number, ILoop: Integer;
Word: Alfa;
Flag: Boolean;
TName: Varying [20] of Char;
Procedure InitObj;
Begin
Add (1, 'NA', DOther);
Add (2, 'AR', DWord);
Add (3, 'CA', DFlag);
Add (4, 'WE', DNum);
Add (5, 'VA', DNum);
Add (6, 'MA', DFlag);
Add (7, 'PE', DFlag);
Add (8, 'TY', DWord);
Add (9, 'TO', DNum);
Add (10, 'MI', DNum);
Add (11, 'MH', DNum);
Add (12, 'SL', DNum);
Add (13, 'WP', DNum);
Add (14, 'SF', DNum);
Add (15, 'SH', DNum);
Add (16, 'AF', DNum);
Add (17, 'AH', DNum);
Add (18, 'DI', DNum);
Add (19, 'DR', DNum);
Add (20, 'IN', DFlag);
Add (21, 'MU', DNum);
Add (22, 'SP', DNum);
Add (23, 'CC', DFlag);
Add (24, 'CT', DNum);
Add (25, 'CI', DNum);
Add (26, 'XX', DNum);
Add (27, 'CL', DNum);
Add (28, 'DC', DFlag);
Add (29, 'DT', DNum);
Add (30, 'DL', DNum);
Add (31, 'UL', DNum);
Add (32, 'CH', DNum);
Add (33, 'RO', DNum);
Add (34, 'WT', DWord);
NP := 0
End (*InitObj*);
Procedure SetClass (Obj: ObjectPoint; Class: ObClassType);
Begin
With Obj ^ Do
Begin
ObClass := Class;
Case Class of
Portal:
Begin
ToWhere := 1;
Carry := False
End (*Portal*);
Weap:
Begin
MinHP := 1;
MaxHP := 1;
Strikes := 1;
WeaPlus := 0;
WeapType := Sharp
End (*Weap*);
Shield:
Begin
ShPlus := 1;
ShHits := 5
End (*Shield*);
Armor:
Begin
ArmPlus := 1;
ArmHits := 5
End (*Armor*);
Coins:
Multiplier := 1;
Scroll:
Spell := 1;
Chest:
Begin
Closed := False;
Locked := 0;
Trap := 0;
NumInside := 0;
ObjectTail := NIL
End (*Chest*);
Door:
Begin
Carry := False;
DToWhere := 1;
DClosed := False;
DTrap := 0;
DLocked := 0
End (*Door*);
Keys:
UnLock := 0;
MagDevice:
Begin
MSpell := 1;
NumCharges := 1
End (*MagDevice*);
Teleport:
Begin
TToWhere := 1;
TActiveRm := 1
End (*TelePort*)
End (*Case*)
End (*With*)
End (*SetClass*);
Procedure BadClass;
Begin
Writev (B1, '0', Parms[WhichParm].PName: 3,
' - Bad parameter for this obtype. Mod not made.');
QOut (Term, B1)
End (*BadClass*);
Begin (*ModObject*)
InitObj;
If (Object <> NIL)
Then
With Object ^ Do
Begin
NP := NP + 1;
WhichParm := GetEditParm (Parms, 34, Word, Number,
Flag, Buffer, LenBuf, Loc);
While WhichParm > 0 Do
Begin
Case WhichParm of
1:
Begin
While (Buffer [Loc] <> '"') And (Loc <= LenBuf) Do
Loc := Loc + 1;
If Loc < LenBuf
Then
Begin
Loc := Loc + 1;
TName := ' ';
TName := '';
ILoop := 1;
While (Buffer [Loc] <> '"') And (Loc <= LenBuf) Do
Begin
If ILoop <= 20
Then
Begin
TName := TName + Buffer [Loc];
ILoop := ILoop + 1
End (*If*);
Loc := Loc + 1
End (*While*);
Loc := Loc + 1;
If (Pos ('*', TName) = 0) or (Pos (',', TName) = 0)
Then
QOut (Term, '0Illegal name.')
Else
Name := TName
End (*If*)
End (*1*);
2:
Case Cap (Word [1]) of
'A':
If Word [2] in ['N', 'n']
Then
Article := An
Else
Article := A;
'N':
Article := None;
'S':
Article := Some;
'T':
Article := The
End (*Case*);
3:
Carry := Flag;
4:
Weight := Max (0, Min (1000, Number));
5:
Price := Max (0, Min (16000, Number));
6:
Magic := Flag;
7:
Permanent := Flag;
8:
Begin
CapAlfa (Word);
Case Word [1] of
'A':
SetClass (Object, Armor);
'C':
Case Word [2] of
'A':
SetClass (Object, Card);
'H':
SetClass (Object, Chest);
'O':
SetClass (Object, Coins)
End (*Case*);
'D':
SetClass (Object, Door);
'K':
SetClass (Object, Keys);
'M':
If Word[2] = 'I'
Then
SetClass (Object, Misc)
Else
SetClass (Object, MagDevice);
'P':
SetClass (Object, Portal);
'S':
If Word[2] = 'C'
Then
SetClass (Object, Scroll)
Else
SetClass (Object, Shield);
'T':
If Word[2] = 'E'
Then
SetClass (Object, Teleport)
Else
SetClass (Object, Treasure);
'W':
SetClass (Object, Weap)
End (*Case*)
End (*8*);
9:
If ObClass in [Portal, Door, Teleport]
Then
ToWhere := Max (0, Min (NumRooms, Number))
Else
BadClass;
10:
If ObClass = Weap Then
MinHp := Max (0, Min (127, Number))
Else
BadClass;
11:
If ObClass = Weap Then
MaxHp := Max (0, Min (127, Number))
Else
BadClass;
12:
If ObClass = Weap
Then
Strikes := Max (0, Min (511, Number))
Else
BadClass;
13:
If ObClass = Weap
Then
WeaPlus := Max (-5, Min (10, Number))
Else
BadClass;
14, 16:
If ObClass in [Shield, Armor]
Then
ShPlus := Max (-5, Min (10, Number))
Else
BadClass;
15, 17:
If ObClass in [Shield, Armor]
Then
ShHits := Max (0, Min (511, Number))
Else
BadClass;
18:
DescCode := Max (0, Min (StrPerSeg, Number));
19:
DescRec := Max (0, Min (256, Number));
20:
Invisible := Flag;
21:
If ObClass = Coins
Then
Multiplier := Max (0, Min (127, Number))
Else
BadClass;
22:
If ObClass = Scroll
Then
Spell := Max (0, Min (NumSpells, Number))
Else
If ObClass = MagDevice
Then
MSpell := Max (0, Min (NumSpells, Number));
23:
If ObClass = Chest
Then
Closed := Flag
Else
BadClass;
24:
If ObClass = Chest
Then
Trap := Max (0, Min (50, Number))
Else
BadClass;
25:
If ObClass = Chest
Then
NumInside := Max (0, Min (10, Number))
Else
BadClass;
26:
QOut (Term, '0Not implemented yet.');