This repository has been archived by the owner on Jan 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathinterpreter-quinn.c
1392 lines (1221 loc) · 38.2 KB
/
interpreter-quinn.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
/* ************************************************************************
* file: Interpreter.c , Command interpreter module. Part of DIKUMUD *
* Usage: Procedures interpreting user command *
* Copyright (C) 1990, 1991 - see 'license.doc' for complete information. *
************************************************************************* */
/* This won't work */
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include "structs.h"
#include "comm.h"
#include "interpreter.h"
#include "db.h"
#include "utils.h"
#include "limits.h"
#define COMMANDO(number,min_pos,pointer,min_level) { \
cmd_info[(number)].command_pointer = (pointer); \
cmd_info[(number)].minimum_position = (min_pos); \
cmd_info[(number)].minimum_level = (min_level); }
#define NOT !
#define AND &&
#define OR ||
#define STATE(d) ((d)->connected)
#define MAX_CMD_LIST 250
extern const struct title_type titles[4][25];
extern char motd[MAX_STRING_LENGTH];
extern struct char_data *character_list;
extern struct player_index_element *player_table;
extern int top_of_p_table;
extern struct index_data *mob_index;
extern struct index_data *obj_index;
extern struct room_data *world;
struct command_info cmd_info[MAX_CMD_LIST];
/* external fcntls */
void set_title(struct char_data *ch);
void init_char(struct char_data *ch);
void store_to_char(struct char_file_u *st, struct char_data *ch);
int create_entry(char *name);
int special(struct char_data *ch, int cmd, char *arg);
void log(char *str);
void do_move(struct char_data *ch, char *argument, int cmd);
void do_look(struct char_data *ch, char *argument, int cmd);
void do_read(struct char_data *ch, char *argument, int cmd);
void do_say(struct char_data *ch, char *argument, int cmd);
void do_exit(struct char_data *ch, char *argument, int cmd);
void do_snoop(struct char_data *ch, char *argument, int cmd);
void do_insult(struct char_data *ch, char *argument, int cmd);
void do_quit(struct char_data *ch, char *argument, int cmd);
void do_qui(struct char_data *ch, char *argument, int cmd);
void do_help(struct char_data *ch, char *argument, int cmd);
void do_who(struct char_data *ch, char *argument, int cmd);
void do_emote(struct char_data *ch, char *argument, int cmd);
void do_echo(struct char_data *ch, char *argument, int cmd);
void do_trans(struct char_data *ch, char *argument, int cmd);
void do_kill(struct char_data *ch, char *argument, int cmd);
void do_stand(struct char_data *ch, char *argument, int cmd);
void do_sit(struct char_data *ch, char *argument, int cmd);
void do_rest(struct char_data *ch, char *argument, int cmd);
void do_sleep(struct char_data *ch, char *argument, int cmd);
void do_wake(struct char_data *ch, char *argument, int cmd);
void do_force(struct char_data *ch, char *argument, int cmd);
void do_get(struct char_data *ch, char *argument, int cmd);
void do_drop(struct char_data *ch, char *argument, int cmd);
void do_news(struct char_data *ch, char *argument, int cmd);
void do_score(struct char_data *ch, char *argument, int cmd);
void do_inventory(struct char_data *ch, char *argument, int cmd);
void do_equipment(struct char_data *ch, char *argument, int cmd);
void do_shout(struct char_data *ch, char *argument, int cmd);
void do_not_here(struct char_data *ch, char *argument, int cmd);
void do_tell(struct char_data *ch, char *argument, int cmd);
void do_wear(struct char_data *ch, char *argument, int cmd);
void do_wield(struct char_data *ch, char *argument, int cmd);
void do_grab(struct char_data *ch, char *argument, int cmd);
void do_remove(struct char_data *ch, char *argument, int cmd);
void do_put(struct char_data *ch, char *argument, int cmd);
void do_shutdown(struct char_data *ch, char *argument, int cmd);
void do_save(struct char_data *ch, char *argument, int cmd);
void do_hit(struct char_data *ch, char *argument, int cmd);
void do_string(struct char_data *ch, char *arg, int cmd);
void do_give(struct char_data *ch, char *arg, int cmd);
void do_stat(struct char_data *ch, char *arg, int cmd);
void do_setskill(struct char_data *ch, char *arg, int cmd);
void do_time(struct char_data *ch, char *arg, int cmd);
void do_weather(struct char_data *ch, char *arg, int cmd);
void do_load(struct char_data *ch, char *arg, int cmd);
void do_purge(struct char_data *ch, char *arg, int cmd);
void do_shutdow(struct char_data *ch, char *arg, int cmd);
void do_idea(struct char_data *ch, char *arg, int cmd);
void do_typo(struct char_data *ch, char *arg, int cmd);
void do_bug(struct char_data *ch, char *arg, int cmd);
void do_whisper(struct char_data *ch, char *arg, int cmd);
void do_cast(struct char_data *ch, char *arg, int cmd);
void do_at(struct char_data *ch, char *arg, int cmd);
void do_goto(struct char_data *ch, char *arg, int cmd);
void do_ask(struct char_data *ch, char *arg, int cmd);
void do_drink(struct char_data *ch, char *arg, int cmd);
void do_eat(struct char_data *ch, char *arg, int cmd);
void do_pour(struct char_data *ch, char *arg, int cmd);
void do_sip(struct char_data *ch, char *arg, int cmd);
void do_taste(struct char_data *ch, char *arg, int cmd);
void do_order(struct char_data *ch, char *arg, int cmd);
void do_follow(struct char_data *ch, char *arg, int cmd);
void do_rent(struct char_data *ch, char *arg, int cmd);
void do_offer(struct char_data *ch, char *arg, int cmd);
void do_advance(struct char_data *ch, char *arg, int cmd);
void do_close(struct char_data *ch, char *arg, int cmd);
void do_open(struct char_data *ch, char *arg, int cmd);
void do_lock(struct char_data *ch, char *arg, int cmd);
void do_unlock(struct char_data *ch, char *arg, int cmd);
void do_exits(struct char_data *ch, char *arg, int cmd);
void do_enter(struct char_data *ch, char *arg, int cmd);
void do_leave(struct char_data *ch, char *arg, int cmd);
void do_write(struct char_data *ch, char *arg, int cmd);
void do_flee(struct char_data *ch, char *arg, int cmd);
void do_sneak(struct char_data *ch, char *arg, int cmd);
void do_hide(struct char_data *ch, char *arg, int cmd);
void do_backstab(struct char_data *ch, char *arg, int cmd);
void do_pick(struct char_data *ch, char *arg, int cmd);
void do_steal(struct char_data *ch, char *arg, int cmd);
void do_bash(struct char_data *ch, char *arg, int cmd);
void do_rescue(struct char_data *ch, char *arg, int cmd);
void do_kick(struct char_data *ch, char *arg, int cmd);
void do_examine(struct char_data *ch, char *arg, int cmd);
void do_info(struct char_data *ch, char *arg, int cmd);
void do_users(struct char_data *ch, char *arg, int cmd);
void do_where(struct char_data *ch, char *arg, int cmd);
void do_levels(struct char_data *ch, char *arg, int cmd);
void do_reroll(struct char_data *ch, char *arg, int cmd);
void do_brief(struct char_data *ch, char *arg, int cmd);
void do_wizlist(struct char_data *ch, char *arg, int cmd);
void do_consider(struct char_data *ch, char *arg, int cmd);
void do_group(struct char_data *ch, char *arg, int cmd);
void do_restore(struct char_data *ch, char *arg, int cmd);
void do_return(struct char_data *ch, char *argument, int cmd);
void do_switch(struct char_data *ch, char *argument, int cmd);
void do_quaff(struct char_data *ch, char *argument, int cmd);
void do_recite(struct char_data *ch, char *argument, int cmd);
void do_use(struct char_data *ch, char *argument, int cmd);
void do_pose(struct char_data *ch, char *argument, int cmd);
void do_noshout(struct char_data *ch, char *argument, int cmd);
void do_wizhelp(struct char_data *ch, char *argument, int cmd);
void do_credits(struct char_data *ch, char *argument, int cmd);
void do_action(struct char_data *ch, char *arg, int cmd);
void do_practice(struct char_data *ch, char *arg, int cmd);
char *command[]=
{ "north", /* 1 */
"east",
"south",
"west",
"up",
"down",
"enter",
"exits",
"kiss",
"get",
"drink", /* 11 */
"eat",
"wear",
"wield",
"look",
"score",
"say",
"shout",
"tell",
"inventory",
"qui", /* 21 */
"bounce",
"smile",
"dance",
"kill",
"cackle",
"laugh",
"giggle",
"shake",
"puke",
"growl", /* 31 */
"scream",
"insult",
"comfort",
"nod",
"sigh",
"sulk",
"help",
"who",
"emote",
"echo", /* 41 */
"stand",
"sit",
"rest",
"sleep",
"wake",
"force",
"transfer",
"hug",
"snuggle",
"cuddle", /* 51 */
"nuzzle",
"cry",
"news",
"equipment",
"buy",
"sell",
"value",
"list",
"drop",
"goto", /* 61 */
"weather",
"read",
"pour",
"grab",
"remove",
"put",
"shutdow",
"save",
"hit",
"string", /* 71 */
"give",
"quit",
"stat",
"setskill",
"time",
"load",
"purge",
"shutdown",
"idea",
"typo", /* 81 */
"bug",
"whisper",
"cast",
"at",
"ask",
"order",
"sip",
"taste",
"snoop",
"follow", /* 91 */
"rent",
"offer",
"poke",
"advance",
"accuse",
"grin",
"bow",
"open",
"close",
"lock", /* 101 */
"unlock",
"leave",
"applaud",
"blush",
"burp",
"chuckle",
"clap",
"cough",
"curtsey",
"fart", /* 111 */
"flip",
"fondle",
"frown",
"gasp",
"glare",
"groan",
"grope",
"hiccup",
"lick",
"love", /* 121 */
"moan",
"nibble",
"pout",
"purr",
"ruffle",
"shiver",
"shrug",
"sing",
"slap",
"smirk", /* 131 */
"snap",
"sneeze",
"snicker",
"sniff",
"snore",
"spit",
"squeeze",
"stare",
"strut",
"thank", /* 141 */
"twiddle",
"wave",
"whistle",
"wiggle",
"wink",
"yawn",
"snowball",
"write",
"hold",
"flee", /* 151 */
"sneak",
"hide",
"backstab",
"pick",
"steal",
"bash",
"rescue",
"kick",
"french",
"comb", /* 161 */
"massage",
"tickle",
"practice",
"pat",
"examine",
"take",
"info",
"'",
"practise",
"curse", /* 171 */
"use",
"where",
"levels",
"reroll",
"pray",
",",
"beg",
"bleed",
"cringe",
"daydream", /* 181 */
"fume",
"grovel",
"hop",
"nudge",
"peer",
"point",
"ponder",
"punch",
"snarl",
"spank", /* 191 */
"steam",
"tackle",
"taunt",
"think",
"whine",
"worship",
"yodel",
"brief",
"wizlist",
"consider", /* 201 */
"group",
"restore",
"return",
"switch", /* 205 */
"quaff",
"recite",
"users",
"pose",
"noshout",
"wizhelp", /* 211 */
"credits",
"\n"
};
char *fill[]=
{ "in",
"from",
"with",
"the",
"on",
"at",
"to",
"\n"
};
int search_block(char *arg, char **list, bool exact)
{
register int i,l;
/* Make into lower case, and get length of string */
for(l=0; *(arg+l); l++)
*(arg+l)=LOWER(*(arg+l));
if (exact) {
for(i=0; **(list+i) != '\n'; i++)
if (!strcmp(arg, *(list+i)))
return(i);
} else {
if (!l)
l=1; /* Avoid "" to match the first available string */
for(i=0; **(list+i) != '\n'; i++)
if (!strncmp(arg, *(list+i), l))
return(i);
}
return(-1);
}
int old_search_block(char *argument,int begin,int length,char **list,int mode)
{
int guess, found, search;
/* If the word contain 0 letters, then a match is already found */
found = (length < 1);
guess = 0;
/* Search for a match */
if(mode)
while ( NOT found AND *(list[guess]) != '\n' )
{
found=(length==strlen(list[guess]));
for(search=0;( search < length AND found );search++)
found=(*(argument+begin+search)== *(list[guess]+search));
guess++;
} else {
while ( NOT found AND *(list[guess]) != '\n' ) {
found=1;
for(search=0;( search < length AND found );search++)
found=(*(argument+begin+search)== *(list[guess]+search));
guess++;
}
}
return ( found ? guess : -1 );
}
void command_interpreter(struct char_data *ch, char *argument)
{
int look_at, cmd, begin;
extern int no_specials;
REMOVE_BIT(ch->specials.affected_by, AFF_HIDE);
/* Find first non blank */
for (begin = 0 ; (*(argument + begin ) == ' ' ) ; begin++ );
/* Find length of first word */
for (look_at = 0; *(argument + begin + look_at ) > ' ' ; look_at++)
/* Make all letters lower case AND find length */
*(argument + begin + look_at) =
LOWER(*(argument + begin + look_at));
cmd = old_search_block(argument,begin,look_at,command,0);
if (!cmd)
return;
if ( cmd>0 && GET_LEVEL(ch)<cmd_info[cmd].minimum_level )
{
send_to_char("Arglebargle, glop-glyf!?!\n\r", ch);
return;
}
if ( cmd>0 && (cmd_info[cmd].command_pointer != 0))
{
if( GET_POS(ch) < cmd_info[cmd].minimum_position )
switch(GET_POS(ch))
{
case POSITION_DEAD:
send_to_char("Lie still; you are DEAD!!! :-( \n\r", ch);
break;
case POSITION_INCAP:
case POSITION_MORTALLYW:
send_to_char(
"You are in a pretty bad shape, unable to do anything!\n\r",
ch);
break;
case POSITION_STUNNED:
send_to_char(
"All you can do right now, is think about the stars!\n\r", ch);
break;
case POSITION_SLEEPING:
send_to_char("In your dreams, or what?\n\r", ch);
break;
case POSITION_RESTING:
send_to_char("Nah... You feel too relaxed to do that..\n\r",
ch);
break;
case POSITION_SITTING:
send_to_char("Maybe you should get on your feet first?\n\r",ch);
break;
case POSITION_FIGHTING:
send_to_char("No way! You are fighting for your life!\n\r", ch);
break;
}
else
{
if (!no_specials && special(ch, cmd, argument + begin + look_at))
return;
((*cmd_info[cmd].command_pointer)
(ch, argument + begin + look_at, cmd));
}
return;
}
if ( cmd>0 && (cmd_info[cmd].command_pointer == 0))
send_to_char(
"Sorry, but that command has yet to be implemented...\n\r",
ch);
else
send_to_char("Arglebargle, glop-glyf!?!\n\r", ch);
}
void argument_interpreter(char *argument,char *first_arg,char *second_arg )
{
int look_at, found, begin;
found = begin = 0;
do
{
/* Find first non blank */
for ( ;*(argument + begin ) == ' ' ; begin++);
/* Find length of first word */
for ( look_at=0; *(argument+begin+look_at)> ' ' ; look_at++)
/* Make all letters lower case,
AND copy them to first_arg */
*(first_arg + look_at) =
LOWER(*(argument + begin + look_at));
*(first_arg + look_at)='\0';
begin += look_at;
}
while( fill_word(first_arg));
do
{
/* Find first non blank */
for ( ;*(argument + begin ) == ' ' ; begin++);
/* Find length of first word */
for ( look_at=0; *(argument+begin+look_at)> ' ' ; look_at++)
/* Make all letters lower case,
AND copy them to second_arg */
*(second_arg + look_at) =
LOWER(*(argument + begin + look_at));
*(second_arg + look_at)='\0';
begin += look_at;
}
while( fill_word(second_arg));
}
int is_number(char *str)
{
int look_at;
if(*str=='\0')
return(0);
for(look_at=0;*(str+look_at) != '\0';look_at++)
if((*(str+look_at)<'0')||(*(str+look_at)>'9'))
return(0);
return(1);
}
/* Quinn substituted a new one-arg for the old one.. I thought returning a
char pointer would be neat, and avoiding the func-calls would save a
little time... If anyone feels pissed, I'm sorry.. Anyhow, the code is
snatched from the old one, so it outta work..
void one_argument(char *argument,char *first_arg )
{
static char dummy[MAX_STRING_LENGTH];
argument_interpreter(argument,first_arg,dummy);
}
*/
/* find the first sub-argument of a string, return pointer to first char in
primary argument, following the sub-arg */
char *one_argument(char *argument, char *first_arg )
{
int found, begin, look_at;
found = begin = 0;
do
{
/* Find first non blank */
for ( ;isspace(*(argument + begin)); begin++);
/* Find length of first word */
for (look_at=0; *(argument+begin+look_at) > ' ' ; look_at++)
/* Make all letters lower case,
AND copy them to first_arg */
*(first_arg + look_at) =
LOWER(*(argument + begin + look_at));
*(first_arg + look_at)='\0';
begin += look_at;
}
while (fill_word(first_arg));
return(argument+begin);
}
int fill_word(char *argument)
{
return ( search_block(argument,fill,TRUE) >= 0);
}
/* determine if a given string is an abbreviation of another */
int is_abbrev(char *arg1, char *arg2)
{
if (!*arg1)
return(0);
for (; *arg1; arg1++, arg2++)
if (LOWER(*arg1) != LOWER(*arg2))
return(0);
return(1);
}
/* return first 'word' plus trailing substring of input string */
void half_chop(char *string, char *arg1, char *arg2)
{
for (; isspace(*string); string++);
for (; !isspace(*arg1 = *string) && *string; string++, arg1++);
*arg1 = '\0';
for (; isspace(*string); string++);
for (; *arg2 = *string; string++, arg2++);
}
int special(struct char_data *ch, int cmd, char *arg)
{
register struct obj_data *i;
register struct char_data *k;
int j;
/* special in room? */
if (world[ch->in_room].funct)
if ((*world[ch->in_room].funct)(ch, cmd, arg))
return(1);
/* special in equipment list? */
for (j = 0; j <= (MAX_WEAR - 1); j++)
if (ch->equipment[j] && ch->equipment[j]->item_number>=0)
if (obj_index[ch->equipment[j]->item_number].func)
if ((*obj_index[ch->equipment[j]->item_number].func)
(ch, cmd, arg))
return(1);
/* special in inventory? */
for (i = ch->carrying; i; i = i->next_content)
if (i->item_number>=0)
if (obj_index[i->item_number].func)
if ((*obj_index[i->item_number].func)(ch, cmd, arg))
return(1);
/* special in mobile present? */
for (k = world[ch->in_room].people; k; k = k->next_in_room)
if ( IS_MOB(k) )
if (mob_index[k->nr].func)
if ((*mob_index[k->nr].func)(ch, cmd, arg))
return(1);
/* special in object present? */
for (i = world[ch->in_room].contents; i; i = i->next_content)
if (i->item_number>=0)
if (obj_index[i->item_number].func)
if ((*obj_index[i->item_number].func)(ch, cmd, arg))
return(1);
return(0);
}
void assign_command_pointers ( void )
{
int position;
for (position = 0 ; position < MAX_CMD_LIST; position++)
cmd_info[position].command_pointer = 0;
COMMANDO(1,POSITION_STANDING,do_move,0);
COMMANDO(2,POSITION_STANDING,do_move,0);
COMMANDO(3,POSITION_STANDING,do_move,0);
COMMANDO(4,POSITION_STANDING,do_move,0);
COMMANDO(5,POSITION_STANDING,do_move,0);
COMMANDO(6,POSITION_STANDING,do_move,0);
COMMANDO(7,POSITION_STANDING,do_enter,0);
COMMANDO(8,POSITION_RESTING,do_exits,0);
COMMANDO(9,POSITION_RESTING,do_action,0);
COMMANDO(10,POSITION_RESTING,do_get,0);
COMMANDO(11,POSITION_RESTING,do_drink,0);
COMMANDO(12,POSITION_RESTING,do_eat,0);
COMMANDO(13,POSITION_RESTING,do_wear,0);
COMMANDO(14,POSITION_RESTING,do_wield,0);
COMMANDO(15,POSITION_RESTING,do_look,0);
COMMANDO(16,POSITION_DEAD,do_score,0);
COMMANDO(17,POSITION_RESTING,do_say,0);
COMMANDO(18,POSITION_RESTING,do_shout,0);
COMMANDO(19,POSITION_DEAD,do_tell,0);
COMMANDO(20,POSITION_DEAD,do_inventory,0);
COMMANDO(21,POSITION_DEAD,do_qui,0);
COMMANDO(22,POSITION_STANDING,do_action,0);
COMMANDO(23,POSITION_RESTING,do_action,0);
COMMANDO(24,POSITION_STANDING,do_action,0);
COMMANDO(25,POSITION_FIGHTING,do_kill,0);
COMMANDO(26,POSITION_RESTING,do_action,0);
COMMANDO(27,POSITION_RESTING,do_action,0);
COMMANDO(28,POSITION_RESTING,do_action,0);
COMMANDO(29,POSITION_RESTING,do_action,0);
COMMANDO(30,POSITION_RESTING,do_action,0);
COMMANDO(31,POSITION_RESTING,do_action,0);
COMMANDO(32,POSITION_RESTING,do_action,0);
COMMANDO(33,POSITION_RESTING,do_insult,0);
COMMANDO(34,POSITION_RESTING,do_action,0);
COMMANDO(35,POSITION_RESTING,do_action,0);
COMMANDO(36,POSITION_RESTING,do_action,0);
COMMANDO(37,POSITION_RESTING,do_action,0);
COMMANDO(38,POSITION_DEAD,do_help,0);
COMMANDO(39,POSITION_DEAD,do_who,0);
COMMANDO(40,POSITION_SLEEPING,do_emote,1);
COMMANDO(41,POSITION_SLEEPING,do_echo,21);
COMMANDO(42,POSITION_RESTING,do_stand,0);
COMMANDO(43,POSITION_RESTING,do_sit,0);
COMMANDO(44,POSITION_RESTING,do_rest,0);
COMMANDO(45,POSITION_SLEEPING,do_sleep,0);
COMMANDO(46,POSITION_SLEEPING,do_wake,0);
COMMANDO(47,POSITION_SLEEPING,do_force,22);
COMMANDO(48,POSITION_SLEEPING,do_trans,22);
COMMANDO(49,POSITION_RESTING,do_action,0);
COMMANDO(50,POSITION_RESTING,do_action,0);
COMMANDO(51,POSITION_RESTING,do_action,0);
COMMANDO(52,POSITION_RESTING,do_action,0);
COMMANDO(53,POSITION_RESTING,do_action,0);
COMMANDO(54,POSITION_SLEEPING,do_news,0);
COMMANDO(55,POSITION_SLEEPING,do_equipment,0);
COMMANDO(56,POSITION_STANDING,do_not_here,0);
COMMANDO(57,POSITION_STANDING,do_not_here,0);
COMMANDO(58,POSITION_STANDING,do_not_here,0);
COMMANDO(59,POSITION_STANDING,do_not_here,0);
COMMANDO(60,POSITION_RESTING,do_drop,0);
COMMANDO(61,POSITION_SLEEPING,do_goto,21);
COMMANDO(62,POSITION_RESTING,do_weather,0);
COMMANDO(63,POSITION_RESTING,do_read,0);
COMMANDO(64,POSITION_STANDING,do_pour,0);
COMMANDO(65,POSITION_RESTING,do_grab,0);
COMMANDO(66,POSITION_RESTING,do_remove,0);
COMMANDO(67,POSITION_RESTING,do_put,0);
COMMANDO(68,POSITION_DEAD,do_shutdow,24);
COMMANDO(69,POSITION_SLEEPING,do_save,0);
COMMANDO(70,POSITION_FIGHTING,do_hit,0);
COMMANDO(71,POSITION_SLEEPING,do_string,23);
COMMANDO(72,POSITION_RESTING,do_give,0);
COMMANDO(73,POSITION_DEAD,do_quit,0);
COMMANDO(74,POSITION_DEAD,do_stat,21);
COMMANDO(75,POSITION_SLEEPING,do_setskill,22);
COMMANDO(76,POSITION_DEAD,do_time,0);
COMMANDO(77,POSITION_DEAD,do_load,22);
COMMANDO(78,POSITION_DEAD,do_purge,22);
COMMANDO(79,POSITION_DEAD,do_shutdown,24);
COMMANDO(80,POSITION_DEAD,do_idea,0);
COMMANDO(81,POSITION_DEAD,do_typo,0);
COMMANDO(82,POSITION_DEAD,do_bug,0);
COMMANDO(83,POSITION_RESTING,do_whisper,0);
COMMANDO(84,POSITION_SITTING,do_cast,1);
COMMANDO(85,POSITION_DEAD,do_at,22);
COMMANDO(86,POSITION_RESTING,do_ask,0);
COMMANDO(87,POSITION_RESTING,do_order,1);
COMMANDO(88,POSITION_RESTING,do_sip,0);
COMMANDO(89,POSITION_RESTING,do_taste,0);
COMMANDO(90,POSITION_DEAD,do_snoop,23);
COMMANDO(91,POSITION_RESTING,do_follow,0);
COMMANDO(92,POSITION_STANDING,do_not_here,1);
COMMANDO(93,POSITION_STANDING,do_not_here,1);
COMMANDO(94,POSITION_RESTING,do_action,0);
COMMANDO(95,POSITION_DEAD,do_advance,23);
COMMANDO(96,POSITION_SITTING,do_action,0);
COMMANDO(97,POSITION_RESTING,do_action,0);
COMMANDO(98,POSITION_STANDING,do_action,0);
COMMANDO(99,POSITION_SITTING,do_open,0);
COMMANDO(100,POSITION_SITTING,do_close,0);
COMMANDO(101,POSITION_SITTING,do_lock,0);
COMMANDO(102,POSITION_SITTING,do_unlock,0);
COMMANDO(103,POSITION_STANDING,do_leave,0);
COMMANDO(104,POSITION_RESTING,do_action,0);
COMMANDO(105,POSITION_RESTING,do_action,0);
COMMANDO(106,POSITION_RESTING,do_action,0);
COMMANDO(107,POSITION_RESTING,do_action,0);
COMMANDO(108,POSITION_RESTING,do_action,0);
COMMANDO(109,POSITION_RESTING,do_action,0);
COMMANDO(110,POSITION_STANDING,do_action,0);
COMMANDO(111,POSITION_RESTING,do_action,0);
COMMANDO(112,POSITION_STANDING,do_action,0);
COMMANDO(113,POSITION_RESTING,do_action,0);
COMMANDO(114,POSITION_RESTING,do_action,0);
COMMANDO(115,POSITION_RESTING,do_action,0);
COMMANDO(116,POSITION_RESTING,do_action,0);
COMMANDO(117,POSITION_RESTING,do_action,0);
COMMANDO(118,POSITION_RESTING,do_action,0);
COMMANDO(119,POSITION_RESTING,do_action,0);
COMMANDO(120,POSITION_RESTING,do_action,0);
COMMANDO(121,POSITION_RESTING,do_action,0);
COMMANDO(122,POSITION_RESTING,do_action,0);
COMMANDO(123,POSITION_RESTING,do_action,0);
COMMANDO(124,POSITION_RESTING,do_action,0);
COMMANDO(125,POSITION_RESTING,do_action,0);
COMMANDO(126,POSITION_STANDING,do_action,0);
COMMANDO(127,POSITION_RESTING,do_action,0);
COMMANDO(128,POSITION_RESTING,do_action,0);
COMMANDO(129,POSITION_RESTING,do_action,0);
COMMANDO(130,POSITION_RESTING,do_action,0);
COMMANDO(131,POSITION_RESTING,do_action,0);
COMMANDO(132,POSITION_RESTING,do_action,0);
COMMANDO(133,POSITION_RESTING,do_action,0);
COMMANDO(134,POSITION_RESTING,do_action,0);
COMMANDO(135,POSITION_RESTING,do_action,0);
COMMANDO(136,POSITION_SLEEPING,do_action,0);
COMMANDO(137,POSITION_STANDING,do_action,0);
COMMANDO(138,POSITION_RESTING,do_action,0);
COMMANDO(139,POSITION_RESTING,do_action,0);
COMMANDO(140,POSITION_STANDING,do_action,0);
COMMANDO(141,POSITION_RESTING,do_action,0);
COMMANDO(142,POSITION_RESTING,do_action,0);
COMMANDO(143,POSITION_RESTING,do_action,0);
COMMANDO(144,POSITION_RESTING,do_action,0);
COMMANDO(145,POSITION_STANDING,do_action,0);
COMMANDO(146,POSITION_RESTING,do_action,0);
COMMANDO(147,POSITION_RESTING,do_action,0);
COMMANDO(148,POSITION_STANDING,do_action,22);
COMMANDO(149,POSITION_STANDING,do_write,1);
COMMANDO(150,POSITION_RESTING,do_grab,1);
COMMANDO(151,POSITION_FIGHTING,do_flee,1);
COMMANDO(152,POSITION_STANDING,do_sneak,1);
COMMANDO(153,POSITION_RESTING,do_hide,1);
COMMANDO(154,POSITION_STANDING,do_backstab,1);
COMMANDO(155,POSITION_STANDING,do_pick,1);
COMMANDO(156,POSITION_STANDING,do_steal,1);
COMMANDO(157,POSITION_FIGHTING,do_bash,1);
COMMANDO(158,POSITION_FIGHTING,do_rescue,1);
COMMANDO(159,POSITION_FIGHTING,do_kick,1);
COMMANDO(160,POSITION_RESTING,do_action,0);
COMMANDO(161,POSITION_RESTING,do_action,0);
COMMANDO(162,POSITION_RESTING,do_action,0);
COMMANDO(163,POSITION_RESTING,do_action,0);
COMMANDO(164,POSITION_RESTING,do_practice,1);
COMMANDO(165,POSITION_RESTING,do_action,0);
COMMANDO(166,POSITION_SITTING,do_examine,0);
COMMANDO(167,POSITION_RESTING,do_get,0); /* TAKE */
COMMANDO(168,POSITION_SLEEPING,do_info,0);
COMMANDO(169,POSITION_RESTING,do_say,0);
COMMANDO(170,POSITION_RESTING,do_practice,1);
COMMANDO(171,POSITION_RESTING,do_action,0);
COMMANDO(172,POSITION_SITTING,do_use,1);
COMMANDO(173,POSITION_DEAD,do_where,1);
COMMANDO(174,POSITION_DEAD,do_levels,0);
COMMANDO(175,POSITION_DEAD,do_reroll,24);
COMMANDO(176,POSITION_SITTING,do_action,0);
COMMANDO(177,POSITION_SLEEPING,do_emote,1);
COMMANDO(178,POSITION_RESTING,do_action,0);
COMMANDO(179,POSITION_RESTING,do_action,0);
COMMANDO(180,POSITION_RESTING,do_action,0);
COMMANDO(181,POSITION_SLEEPING,do_action,0);
COMMANDO(182,POSITION_RESTING,do_action,0);
COMMANDO(183,POSITION_RESTING,do_action,0);
COMMANDO(184,POSITION_RESTING,do_action,0);
COMMANDO(185,POSITION_RESTING,do_action,0);
COMMANDO(186,POSITION_RESTING,do_action,0);
COMMANDO(187,POSITION_RESTING,do_action,0);
COMMANDO(188,POSITION_RESTING,do_action,0);
COMMANDO(189,POSITION_RESTING,do_action,0);
COMMANDO(190,POSITION_RESTING,do_action,0);
COMMANDO(191,POSITION_RESTING,do_action,0);
COMMANDO(192,POSITION_RESTING,do_action,0);
COMMANDO(193,POSITION_RESTING,do_action,0);
COMMANDO(194,POSITION_RESTING,do_action,0);
COMMANDO(195,POSITION_RESTING,do_action,0);
COMMANDO(196,POSITION_RESTING,do_action,0);
COMMANDO(197,POSITION_RESTING,do_action,0);
COMMANDO(198,POSITION_RESTING,do_action,0);
COMMANDO(199,POSITION_DEAD,do_brief,0);
COMMANDO(200,POSITION_DEAD,do_wizlist,0);
COMMANDO(201,POSITION_RESTING,do_consider,0);
COMMANDO(202,POSITION_RESTING,do_group,1);
COMMANDO(203,POSITION_DEAD,do_restore,22);
COMMANDO(204,POSITION_DEAD,do_return,0);
COMMANDO(205,POSITION_DEAD,do_switch,23);
COMMANDO(206,POSITION_RESTING,do_quaff,0);
COMMANDO(207,POSITION_RESTING,do_recite,0);
COMMANDO(208,POSITION_DEAD,do_users,21);
COMMANDO(209,POSITION_STANDING,do_pose,0);
COMMANDO(210,POSITION_SLEEPING,do_noshout,22);
COMMANDO(211,POSITION_SLEEPING,do_wizhelp,21);
COMMANDO(212,POSITION_DEAD,do_credits,0);
}
/* *************************************************************************
* Stuff for controlling the non-playing sockets (get name, pwd etc) *
************************************************************************* */
/* locate entry in p_table with entry->name == name. -1 mrks failed search */
int find_name(char *name)
{
int i;
for (i = 0; i <= top_of_p_table; i++)
{
if (!str_cmp((player_table + i)->name, name))
return(i);
}
return(-1);
}
int _parse_name(char *arg, char *name)
{
int i;
/* skip whitespaces */
for (; isspace(*arg); arg++);
for (i = 0; *name = *arg; arg++, i++, name++)
if ((*arg <0) || !isalpha(*arg) || i > 15)
return(1);
if (!i)
return(1);
return(0);
}
/* deal with newcomers and other non-playing sockets */
void nanny(struct descriptor_data *d, char *arg)
{
char buf[100];
int player_i;
char tmp_name[20];
struct char_file_u tmp_store;
struct char_data *ch, *tmp_ch;
struct descriptor_data *k;
extern struct descriptor_data *descriptor_list;
void do_look(struct char_data *ch, char *argument, int cmd);
void load_char_objs(struct char_data *ch);
int load_char(char *name, struct char_file_u *char_element);
switch (STATE(d))
{
case CON_NME: /* wait for input of name */
if (!d->character)
{
CREATE(d->character, struct char_data, 1);
clear_char(d->character);