-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathact.wizard.c
executable file
·9705 lines (8663 loc) · 300 KB
/
act.wizard.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: act.wizard.c Part of LuminariMUD *
* Usage: Player-level god commands and other goodies. *
* *
* All rights reserved. See license for complete information. *
* *
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "handler.h"
#include "db.h"
#include "spells.h"
#include "house.h"
#include "screen.h"
#include "constants.h"
#include "oasis.h"
#include "dg_scripts.h"
#include "shop.h"
#include "act.h"
#include "mysql.h"
#include "genzon.h" /* for real_zone_by_thing */
#include "class.h"
#include "genolc.h"
#include "genobj.h"
#include "race.h"
#include "fight.h"
#include "house.h"
#include "modify.h"
#include "quest.h"
#include "ban.h"
#include "screen.h"
#include "mud_event.h"
#include "clan.h"
#include "craft.h"
#include "hlquest.h"
#include "mudlim.h"
#include "spec_abilities.h"
#include "wilderness.h"
#include "feats.h"
#include "assign_wpn_armor.h"
#include "item.h"
#include "feats.h"
#include "domains_schools.h"
#include "crafts.h" /* NewCraft */
#include "account.h"
#include "alchemy.h"
#include "mud_event.h"
#include "premadebuilds.h"
#include "perfmon.h"
#include "missions.h"
#include "deities.h"
#include "backgrounds.h"
/* local utility functions with file scope */
static int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg);
static void perform_immort_invis(struct char_data *ch, int level);
static void list_zone_commands_room(struct char_data *ch, room_vnum rvnum);
static void do_stat_room(struct char_data *ch, struct room_data *rm);
static void do_stat_scriptvar(struct char_data *ch, struct char_data *k);
static void do_stat_character(struct char_data *ch, struct char_data *k);
static void stop_snooping(struct char_data *ch);
static size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall);
// static struct char_data *is_in_game(long idnum);
static void mob_checkload(struct char_data *ch, mob_vnum mvnum);
static void obj_checkload(struct char_data *ch, obj_vnum ovnum);
static void trg_checkload(struct char_data *ch, trig_vnum tvnum);
static void mod_llog_entry(struct last_entry *llast, int type);
static int get_max_recent(void);
static void clear_recent(struct recent_player *this);
static struct recent_player *create_recent(void);
const char *get_spec_func_name(SPECIAL_DECL(*func));
bool zedit_get_levels(struct descriptor_data *d, char *buf);
bool delete_path(region_vnum vnum);
/* Local Globals */
static struct recent_player *recent_list = NULL; /** Global list of recent players */
// external functions
void save_char_pets(struct char_data *ch);
int purge_room(room_rnum room)
{
int j;
struct char_data *vict;
if (room == NOWHERE || room > top_of_world)
return 0;
for (vict = world[room].people; vict; vict = vict->next_in_room)
{
if (!IS_NPC(vict))
continue;
/* Dump inventory. */
while (vict->carrying)
extract_obj(vict->carrying);
/* Dump equipment. */
for (j = 0; j < NUM_WEARS; j++)
if (GET_EQ(vict, j))
extract_obj(GET_EQ(vict, j));
/* Dump character. */
extract_char(vict);
}
/* Clear the ground. */
while (world[room].contents)
extract_obj(world[room].contents);
return 1;
}
ACMD(do_echo)
{
skip_spaces_c(&argument);
if (!*argument)
send_to_char(ch, "Yes.. but what?\r\n");
else
{
char buf[MAX_INPUT_LENGTH + 4];
if (subcmd == SCMD_EMOTE)
snprintf(buf, sizeof(buf), "$n %s", argument);
else
{
strlcpy(buf, argument, sizeof(buf));
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "(GC) %s echoed: %s", GET_NAME(ch), buf);
}
act(buf, FALSE, ch, 0, 0, TO_ROOM);
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "%s", CONFIG_OK);
else
act(buf, FALSE, ch, 0, 0, TO_CHAR);
}
}
ACMD(do_send)
{
char arg[MAX_INPUT_LENGTH] = {'\0'}, buf[MAX_INPUT_LENGTH] = {'\0'};
struct char_data *vict;
half_chop_c(argument, arg, sizeof(arg), buf, sizeof(buf));
if (!*arg)
{
send_to_char(ch, "Send what to who?\r\n");
return;
}
if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD)))
{
send_to_char(ch, "%s", CONFIG_NOPERSON);
return;
}
send_to_char(vict, "%s\r\n", buf);
mudlog(CMP, MAX(LVL_STAFF, GET_INVIS_LEV(ch)), TRUE, "(GC) %s sent %s: %s", GET_NAME(ch), GET_NAME(vict), buf);
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "Sent.\r\n");
else
send_to_char(ch, "You send '%s' to %s.\r\n", buf, GET_NAME(vict));
}
#if defined(CAMPAIGN_FR) || defined(CAMPAIGN_DL)
/* take a string, and return an rnum.. used for goto, at, etc. -je 4/6/93 */
room_rnum find_target_room(struct char_data *ch, const char *rawroomstr)
{
room_rnum location = NOWHERE;
char roomstr[MAX_INPUT_LENGTH];
one_argument(rawroomstr, roomstr, sizeof(roomstr));
if (!*roomstr)
{
send_to_char(ch, "You must supply a room number or name.\r\n");
return (NOWHERE);
}
if (isdigit(*roomstr) && !strchr(roomstr, '.'))
{
if ((location = real_room((room_vnum)atoi(roomstr))) == NOWHERE)
{
send_to_char(ch, "No room exists with that number.\r\n");
return (NOWHERE);
}
}
else
{
struct char_data *target_mob;
struct obj_data *target_obj;
char *mobobjstr = roomstr;
int num;
int i = 0;
for (i = 0; i < NUM_GOTO_ZONES; i++) {
if (!strcmp(goto_zones[i][0], roomstr))
if ((location = real_room((room_vnum) atol(goto_zones[i][1]))) != NOWHERE)
return location;
}
num = get_number(&mobobjstr);
if ((target_mob = get_char_vis(ch, mobobjstr, &num, FIND_CHAR_WORLD)) != NULL)
{
if ((location = IN_ROOM(target_mob)) == NOWHERE)
{
send_to_char(ch, "That character is currently lost.\r\n");
return (NOWHERE);
}
}
else if ((target_obj = get_obj_vis(ch, mobobjstr, &num)) != NULL)
{
if (IN_ROOM(target_obj) != NOWHERE)
location = IN_ROOM(target_obj);
else if (target_obj->carried_by && IN_ROOM(target_obj->carried_by) != NOWHERE)
location = IN_ROOM(target_obj->carried_by);
else if (target_obj->worn_by && IN_ROOM(target_obj->worn_by) != NOWHERE)
location = IN_ROOM(target_obj->worn_by);
if (location == NOWHERE)
{
send_to_char(ch, "That object is currently not in a room.\r\n");
return (NOWHERE);
}
}
if (location == NOWHERE)
{
send_to_char(ch, "Nothing exists by that name.\r\n");
return (NOWHERE);
}
}
/* A location has been found -- if you're >= GRSTAFF, no restrictions. */
if (GET_LEVEL(ch) >= LVL_GRSTAFF)
return (location);
if (ROOM_FLAGGED(location, ROOM_STAFFROOM))
send_to_char(ch, "You are not godly enough to use that room!\r\n");
else if (ROOM_FLAGGED(location, ROOM_PRIVATE) && world[location].people && world[location].people->next_in_room)
send_to_char(ch, "There's a private conversation going on in that room.\r\n");
else if (ROOM_FLAGGED(location, ROOM_HOUSE) && !House_can_enter(ch, GET_ROOM_VNUM(location)))
send_to_char(ch, "That's private property -- no trespassing!\r\n");
else
return (location);
return (NOWHERE);
}
#else
/* take a string, and return an rnum.. used for goto, at, etc. -je 4/6/93 */
room_rnum find_target_room(struct char_data *ch, const char *rawroomstr)
{
room_rnum location = NOWHERE;
char roomstr[MAX_INPUT_LENGTH] = {'\0'};
one_argument(rawroomstr, roomstr, sizeof(roomstr));
if (!*roomstr)
{
send_to_char(ch, "You must supply a room number or name.\r\n");
return (NOWHERE);
}
if (isdigit(*roomstr) && !strchr(roomstr, '.'))
{
if ((location = real_room((room_vnum)atoi(roomstr))) >= NOWHERE)
{
send_to_char(ch, "No room exists with that number.\r\n");
return (NOWHERE);
}
}
else
{
struct char_data *target_mob;
struct obj_data *target_obj;
char *mobobjstr = roomstr;
int num;
num = get_number(&mobobjstr);
if ((target_mob = get_char_vis(ch, mobobjstr, &num, FIND_CHAR_WORLD)) != NULL)
{
if ((location = IN_ROOM(target_mob)) == NOWHERE)
{
send_to_char(ch, "That character is currently lost.\r\n");
return (NOWHERE);
}
}
else if ((target_obj = get_obj_vis(ch, mobobjstr, &num)) != NULL)
{
if (IN_ROOM(target_obj) != NOWHERE)
location = IN_ROOM(target_obj);
else if (target_obj->carried_by && IN_ROOM(target_obj->carried_by) != NOWHERE)
location = IN_ROOM(target_obj->carried_by);
else if (target_obj->worn_by && IN_ROOM(target_obj->worn_by) != NOWHERE)
location = IN_ROOM(target_obj->worn_by);
if (location == NOWHERE)
{
send_to_char(ch, "That object is currently not in a room.\r\n");
return (NOWHERE);
}
}
if (location == NOWHERE)
{
send_to_char(ch, "Nothing exists by that name.\r\n");
return (NOWHERE);
}
}
/* A location has been found -- if you're >= GRSTAFF, no restrictions. */
if (GET_LEVEL(ch) >= LVL_GRSTAFF)
return (location);
if (ROOM_FLAGGED(location, ROOM_STAFFROOM))
send_to_char(ch, "You are not godly enough to use that room!\r\n");
else if (ROOM_FLAGGED(location, ROOM_PRIVATE) && world[location].people && world[location].people->next_in_room)
send_to_char(ch, "There's a private conversation going on in that room.\r\n");
else if (ROOM_FLAGGED(location, ROOM_HOUSE) && !House_can_enter(ch, GET_ROOM_VNUM(location)))
send_to_char(ch, "That's private property -- no trespassing!\r\n");
else
return (location);
return (NOWHERE);
}
#endif
ACMD(do_at)
{
char command[MAX_INPUT_LENGTH] = {'\0'}, buf[MAX_INPUT_LENGTH] = {'\0'};
room_rnum location, original_loc;
int orig_x, orig_y; /* Needed if 'at'ing in the wilderness. */
half_chop_c(argument, buf, sizeof(buf), command, sizeof(command));
if (!*buf)
{
send_to_char(ch, "You must supply a room number or a name.\r\n");
return;
}
if (!*command)
{
send_to_char(ch, "What do you want to do there?\r\n");
return;
}
if ((location = find_target_room(ch, buf)) == NOWHERE)
return;
/* a location has been found. */
original_loc = IN_ROOM(ch);
orig_x = X_LOC(ch);
orig_y = Y_LOC(ch);
char_from_room(ch);
if (ZONE_FLAGGED(GET_ROOM_ZONE(location), ZONE_WILDERNESS))
{
X_LOC(ch) = world[location].coords[0];
Y_LOC(ch) = world[location].coords[1];
}
char_to_room(ch, location);
command_interpreter(ch, command);
/* check if the char is still there */
if (IN_ROOM(ch) == location)
{
char_from_room(ch);
X_LOC(ch) = orig_x;
Y_LOC(ch) = orig_y;
char_to_room(ch, original_loc);
}
}
ACMD(do_goto)
{
char buf[MAX_STRING_LENGTH] = {'\0'};
char arg[MAX_INPUT_LENGTH] = {'\0'}, arg2[MAX_INPUT_LENGTH] = {'\0'};
room_rnum location = NOWHERE;
int i = 0;
bool has_space = false;
two_arguments(argument, arg, sizeof(arg), arg2, sizeof(arg2));
if (!*arg2)
{
for (i = 1; i < strlen(argument); i++)
{
if (isspace(argument[i])) has_space = true;
}
if (has_space)
{
send_to_char(ch, "That is an invalid goto location. Please use:\r\n"
"goto (room vnum) eg. goto 200\r\n"
"goto (mob or player name) eg. goto gicker or goto cave-troll\r\n"
"goto (zone name) eg. goto lusken\r\n");
return;
}
if ((location = find_target_room(ch, argument)) == NOWHERE)
return;
}
#if !defined(CAMPAIGN_DL) && !defined(CAMPAIGN_FR)
else
{
/* Have two args, that means coordinates (potentially) */
if ((location = find_room_by_coordinates(atoi(arg), atoi(arg2))) == NOWHERE)
{
if ((location = find_available_wilderness_room()) == NOWHERE)
{
return;
}
else
{
/* Must set the coords, etc in the going_to room. */
assign_wilderness_room(location, atoi(arg), atoi(arg2));
}
}
}
#endif
for (i = 1; i < strlen(argument); i++)
{
if (isspace(argument[i])) has_space = true;
}
if (has_space)
{
send_to_char(ch, "That is an invalid goto location. Please use:\r\n"
"goto (room vnum) eg. goto 200\r\n"
"goto (mob or player name) eg. goto gicker or goto cave-troll\r\n"
"goto (zone name) eg. goto lusken\r\n");
return;
}
if (ZONE_FLAGGED(GET_ROOM_ZONE(location), ZONE_NOIMMORT) && (GET_LEVEL(ch) >= LVL_IMMORT) && (GET_LEVEL(ch) < LVL_GRSTAFF))
{
send_to_char(ch, "Sorry, that zone is off-limits for immortals!");
return;
}
snprintf(buf, sizeof(buf), "$n %s", POOFOUT(ch) ? POOFOUT(ch) : "disappears in a puff of smoke.");
act(buf, TRUE, ch, 0, 0, TO_ROOM);
char_from_room(ch);
if (ZONE_FLAGGED(GET_ROOM_ZONE(location), ZONE_WILDERNESS))
{
// char_to_coords(ch, world[location].coords[0], world[location].coords[1], 0);
X_LOC(ch) = world[location].coords[0];
Y_LOC(ch) = world[location].coords[1];
}
char_to_room(ch, location);
snprintf(buf, sizeof(buf), "$n %s", POOFIN(ch) ? POOFIN(ch) : "appears with an ear-splitting bang.");
act(buf, TRUE, ch, 0, 0, TO_ROOM);
look_at_room(ch, 0);
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
}
ACMD(do_trans)
{
char buf[MAX_INPUT_LENGTH] = {'\0'};
struct descriptor_data *i;
struct char_data *victim;
one_argument(argument, buf, sizeof(buf));
if (!*buf)
send_to_char(ch, "Whom do you wish to transfer?\r\n");
else if (str_cmp("all", buf))
{
if (!(victim = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
send_to_char(ch, "%s", CONFIG_NOPERSON);
else if (victim == ch)
send_to_char(ch, "That doesn't make much sense, does it?\r\n");
else
{
if ((GET_LEVEL(ch) < GET_LEVEL(victim)) && !IS_NPC(victim))
{
send_to_char(ch, "Go transfer someone your own size.\r\n");
return;
}
act("$n disappears in a mushroom cloud.", FALSE, victim, 0, 0, TO_ROOM);
char_from_room(victim);
if (ZONE_FLAGGED(GET_ROOM_ZONE(IN_ROOM(ch)), ZONE_WILDERNESS))
{
X_LOC(victim) = world[IN_ROOM(ch)].coords[0];
Y_LOC(victim) = world[IN_ROOM(ch)].coords[1];
}
char_to_room(victim, IN_ROOM(ch));
act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM);
act("$n has transferred you!", FALSE, ch, 0, victim, TO_VICT);
look_at_room(victim, 0);
enter_wtrigger(&world[IN_ROOM(victim)], victim, -1);
}
}
else
{ /* Trans All */
if (GET_LEVEL(ch) < LVL_GRSTAFF)
{
send_to_char(ch, "I think not.\r\n");
return;
}
for (i = descriptor_list; i; i = i->next)
if (STATE(i) == CON_PLAYING && i->character && i->character != ch)
{
victim = i->character;
if (GET_LEVEL(victim) >= GET_LEVEL(ch))
continue;
act("$n disappears in a mushroom cloud.", FALSE, victim, 0, 0, TO_ROOM);
char_from_room(victim);
if (ZONE_FLAGGED(GET_ROOM_ZONE(IN_ROOM(ch)), ZONE_WILDERNESS))
{
X_LOC(victim) = world[IN_ROOM(ch)].coords[0];
Y_LOC(victim) = world[IN_ROOM(ch)].coords[1];
}
char_to_room(victim, IN_ROOM(ch));
act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM);
act("$n has transferred you!", FALSE, ch, 0, victim, TO_VICT);
look_at_room(victim, 0);
enter_wtrigger(&world[IN_ROOM(victim)], victim, -1);
}
send_to_char(ch, "%s", CONFIG_OK);
}
}
ACMD(do_teleport)
{
char buf[MAX_INPUT_LENGTH] = {'\0'}, buf2[MAX_INPUT_LENGTH] = {'\0'};
struct char_data *victim;
room_rnum target;
two_arguments(argument, buf, sizeof(buf), buf2, sizeof(buf2));
if (!*buf)
send_to_char(ch, "Whom do you wish to teleport?\r\n");
else if (!(victim = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
send_to_char(ch, "%s", CONFIG_NOPERSON);
else if (victim == ch)
send_to_char(ch, "Use 'goto' to teleport yourself.\r\n");
else if (GET_LEVEL(victim) >= GET_LEVEL(ch))
send_to_char(ch, "Maybe you shouldn't do that.\r\n");
else if (!*buf2)
send_to_char(ch, "Where do you wish to send this person?\r\n");
else if ((target = find_target_room(ch, buf2)) != NOWHERE)
{
send_to_char(ch, "%s", CONFIG_OK);
act("$n disappears in a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM);
char_from_room(victim);
if (ZONE_FLAGGED(GET_ROOM_ZONE(target), ZONE_WILDERNESS))
{
X_LOC(victim) = world[target].coords[0];
Y_LOC(victim) = world[target].coords[1];
}
char_to_room(victim, target);
act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM);
act("$n has teleported you!", FALSE, ch, 0, (char *)victim, TO_VICT);
look_at_room(victim, 0);
enter_wtrigger(&world[IN_ROOM(victim)], victim, -1);
}
}
ACMD(do_vnum)
{
char buf[MAX_INPUT_LENGTH] = {'\0'}, buf2[MAX_INPUT_LENGTH] = {'\0'};
int good_arg = 0;
half_chop_c(argument, buf, sizeof(buf), buf2, sizeof(buf2));
if (!*buf || !*buf2)
{
send_to_char(ch, "Usage: vnum { obj | mob | room | trig } <name>\r\n");
return;
}
if (is_abbrev(buf, "mob") && (good_arg = 1))
if (!vnum_mobile(buf2, ch))
send_to_char(ch, "No mobiles by that name.\r\n");
if (is_abbrev(buf, "obj") && (good_arg = 1))
if (!vnum_object(buf2, ch))
send_to_char(ch, "No objects by that name.\r\n");
if (is_abbrev(buf, "room") && (good_arg = 1))
if (!vnum_room(buf2, ch))
send_to_char(ch, "No rooms by that name.\r\n");
if (is_abbrev(buf, "trig") && (good_arg = 1))
if (!vnum_trig(buf2, ch))
send_to_char(ch, "No triggers by that name.\r\n");
if (!good_arg)
send_to_char(ch, "Usage: vnum { obj | mob | room | trig } <name>\r\n");
}
#define ZOCMD zone_table[zrnum].cmd[subcmd]
static void list_zone_commands_room(struct char_data *ch, room_vnum rvnum)
{
zone_rnum zrnum = real_zone_by_thing(rvnum);
room_rnum rrnum = real_room(rvnum), cmd_room = NOWHERE;
int subcmd = 0, count = 0;
if (zrnum == NOWHERE || rrnum == NOWHERE)
{
send_to_char(ch, "No zone information available.\r\n");
return;
}
get_char_colors(ch);
send_to_char(ch, "Zone commands in this room:%s\r\n", yel);
while (ZOCMD.command != 'S')
{
switch (ZOCMD.command)
{
case 'M':
case 'O':
case 'T':
case 'V':
cmd_room = ZOCMD.arg3;
break;
case 'D':
case 'R':
cmd_room = ZOCMD.arg1;
break;
default:
break;
}
if (cmd_room == rrnum)
{
count++;
/* start listing */
switch (ZOCMD.command)
{
case 'I':
send_to_char(ch, "%sGive it random treasure (%d%%)",
ZOCMD.if_flag ? " then " : "",
ZOCMD.arg1);
break;
case 'L':
send_to_char(ch, "%sPut random treasure in %s [%s%d%s] (%d%%)",
ZOCMD.if_flag ? " then " : "",
obj_proto[ZOCMD.arg1].short_description,
cyn, obj_index[ZOCMD.arg1].vnum, yel,
ZOCMD.arg2);
break;
case 'M':
send_to_char(ch, "%sLoad %s [%s%d%s], Max : %d\r\n",
ZOCMD.if_flag ? " then " : "",
mob_proto[ZOCMD.arg1].player.short_descr, cyn,
mob_index[ZOCMD.arg1].vnum, yel, ZOCMD.arg2);
break;
case 'G':
send_to_char(ch, "%sGive it %s [%s%d%s], Max : %d\r\n",
ZOCMD.if_flag ? " then " : "",
obj_proto[ZOCMD.arg1].short_description,
cyn, obj_index[ZOCMD.arg1].vnum, yel,
ZOCMD.arg2);
break;
case 'O':
send_to_char(ch, "%sLoad %s [%s%d%s], Max : %d\r\n",
ZOCMD.if_flag ? " then " : "",
obj_proto[ZOCMD.arg1].short_description,
cyn, obj_index[ZOCMD.arg1].vnum, yel,
ZOCMD.arg2);
break;
case 'E':
send_to_char(ch, "%sEquip with %s [%s%d%s], %s, Max : %d\r\n",
ZOCMD.if_flag ? " then " : "",
obj_proto[ZOCMD.arg1].short_description,
cyn, obj_index[ZOCMD.arg1].vnum, yel,
equipment_types[ZOCMD.arg3],
ZOCMD.arg2);
break;
case 'P':
send_to_char(ch, "%sPut %s [%s%d%s] in %s [%s%d%s], Max : %d\r\n",
ZOCMD.if_flag ? " then " : "",
obj_proto[ZOCMD.arg1].short_description,
cyn, obj_index[ZOCMD.arg1].vnum, yel,
obj_proto[ZOCMD.arg3].short_description,
cyn, obj_index[ZOCMD.arg3].vnum, yel,
ZOCMD.arg2);
break;
case 'R':
send_to_char(ch, "%sRemove %s [%s%d%s] from room.\r\n",
ZOCMD.if_flag ? " then " : "",
obj_proto[ZOCMD.arg2].short_description,
cyn, obj_index[ZOCMD.arg2].vnum, yel);
break;
case 'D':
send_to_char(ch, "%sSet door %s as %s.\r\n",
ZOCMD.if_flag ? " then " : "",
dirs[ZOCMD.arg2],
ZOCMD.arg3 ? ((ZOCMD.arg3 == 1) ? "closed" : "locked") : "open");
break;
case 'T':
send_to_char(ch, "%sAttach trigger %s%s%s [%s%d%s] to %s\r\n",
ZOCMD.if_flag ? " then " : "",
cyn, trig_index[ZOCMD.arg2]->proto->name, yel,
cyn, trig_index[ZOCMD.arg2]->vnum, yel,
((ZOCMD.arg1 == MOB_TRIGGER) ? "mobile" : ((ZOCMD.arg1 == OBJ_TRIGGER) ? "object" : ((ZOCMD.arg1 == WLD_TRIGGER) ? "room" : "????"))));
break;
case 'V':
send_to_char(ch, "%sAssign global %s:%d to %s = %s\r\n",
ZOCMD.if_flag ? " then " : "",
ZOCMD.sarg1, ZOCMD.arg2,
((ZOCMD.arg1 == MOB_TRIGGER) ? "mobile" : ((ZOCMD.arg1 == OBJ_TRIGGER) ? "object" : ((ZOCMD.arg1 == WLD_TRIGGER) ? "room" : "????"))),
ZOCMD.sarg2);
break;
default:
send_to_char(ch, "<Unknown Command>\r\n");
break;
}
}
subcmd++;
}
send_to_char(ch, "%s", nrm);
if (!count)
send_to_char(ch, "None!\r\n");
}
#undef ZOCMD
static void do_stat_room(struct char_data *ch, struct room_data *rm)
{
char buf2[MAX_STRING_LENGTH] = {'\0'};
struct extra_descr_data *desc;
int i, found, column;
struct obj_data *j;
struct char_data *k;
send_to_char(ch, "Room name: %s%s%s\r\n", CCCYN(ch, C_NRM), rm->name, CCNRM(ch, C_NRM));
sprinttype(rm->sector_type, sector_types, buf2, sizeof(buf2));
send_to_char(ch, "Zone: [%3d], VNum: [%s%5d%s], RNum: [%5d], IDNum: [%5ld], Type: %s\r\n",
zone_table[rm->zone].number, CCGRN(ch, C_NRM), rm->number,
CCNRM(ch, C_NRM), real_room(rm->number), (long)rm->number + ROOM_ID_BASE, buf2);
send_to_char(ch, "Coordinate Location (Wilderness only): (%d, %d)\r\n", rm->coords[0], rm->coords[1]);
sprintbitarray(rm->room_flags, room_bits, RF_ARRAY_MAX, buf2);
send_to_char(ch, "SpecProc: %s, Flags: %s\r\n", rm->func == NULL ? "None" : get_spec_func_name(rm->func), buf2);
sprintbit((long)rm->room_affections, room_affections, buf2, sizeof(buf2));
send_to_char(ch, "Room affections: %s\r\n", buf2);
send_to_char(ch, "Description:\r\n%s", rm->description ? rm->description : " None.\r\n");
if (rm->ex_description)
{
send_to_char(ch, "Extra descs:%s", CCCYN(ch, C_NRM));
for (desc = rm->ex_description; desc; desc = desc->next)
send_to_char(ch, " [%s]", desc->keyword);
send_to_char(ch, "%s\r\n", CCNRM(ch, C_NRM));
}
dump_moving(rm->mover, ch);
send_to_char(ch, "Chars present:%s", CCYEL(ch, C_NRM));
column = 14; /* ^^^ strlen ^^^ */
for (found = FALSE, k = rm->people; k; k = k->next_in_room)
{
if (!CAN_SEE(ch, k))
continue;
column += send_to_char(ch, "%s %s(%s)", found++ ? "," : "", GET_NAME(k),
!IS_NPC(k) ? "PC" : (!IS_MOB(k) ? "NPC" : "MOB"));
if (column >= 62)
{
send_to_char(ch, "%s\r\n", k->next_in_room ? "," : "");
found = FALSE;
column = 0;
}
}
send_to_char(ch, "%s", CCNRM(ch, C_NRM));
if (rm->contents)
{
send_to_char(ch, "Contents:%s", CCGRN(ch, C_NRM));
column = 9; /* ^^^ strlen ^^^ */
for (found = 0, j = rm->contents; j; j = j->next_content)
{
if (!CAN_SEE_OBJ(ch, j))
continue;
column += send_to_char(ch, "%s %s", found++ ? "," : "", j->short_description);
if (column >= 62)
{
send_to_char(ch, "%s\r\n", j->next_content ? "," : "");
found = FALSE;
column = 0;
}
}
send_to_char(ch, "%s", CCNRM(ch, C_NRM));
}
for (i = 0; i < DIR_COUNT; i++)
{
char buf1[128];
if (!rm->dir_option[i])
continue;
if (rm->dir_option[i]->to_room == NOWHERE)
snprintf(buf1, sizeof(buf1), " %sNONE%s", CCCYN(ch, C_NRM), CCNRM(ch, C_NRM));
else
snprintf(buf1, sizeof(buf1), "%s%5d%s", CCCYN(ch, C_NRM), GET_ROOM_VNUM(rm->dir_option[i]->to_room), CCNRM(ch, C_NRM));
sprintbit(rm->dir_option[i]->exit_info, exit_bits, buf2, sizeof(buf2));
send_to_char(ch, "Exit %s%-5s%s: To: [%s], Key: [%5d], Keywords: %s, Type: %s\r\n%s",
CCCYN(ch, C_NRM), dirs[i], CCNRM(ch, C_NRM), buf1,
rm->dir_option[i]->key == NOTHING ? -1 : rm->dir_option[i]->key,
rm->dir_option[i]->keyword ? rm->dir_option[i]->keyword : "None", buf2,
rm->dir_option[i]->general_description ? rm->dir_option[i]->general_description : " No exit description.\r\n");
}
/* check the room for a script */
do_sstat_room(ch, rm);
list_zone_commands_room(ch, rm->number);
}
static void do_featstat_character(struct char_data *ch, struct char_data *k)
{
list_feats(k, "", LIST_FEATS_KNOWN, ch);
}
static void do_affstat_character(struct char_data *ch, struct char_data *k)
{
perform_affects(ch, k);
perform_cooldowns(ch, k);
perform_resistances(ch, k);
perform_abilities(ch, k);
}
static void do_stat_scriptvar(struct char_data *ch, struct char_data *k)
{
/* check mobiles for a script */
do_sstat_character(ch, k);
if (SCRIPT_MEM(k))
{
struct script_memory *mem = SCRIPT_MEM(k);
send_to_char(ch, "\tCScript memory:\r\n Remember Command\r\n\tn");
while (mem)
{
struct char_data *mc = find_char(mem->id);
if (!mc)
send_to_char(ch, " \tC** Corrupted!\tn\r\n");
else
{
if (mem->cmd)
send_to_char(ch, " %-20.20s%s\r\n", GET_NAME(mc), mem->cmd);
else
send_to_char(ch, " %-20.20s <default>\r\n", GET_NAME(mc));
}
mem = mem->next;
}
send_to_char(ch, "\r\n");
}
if (!(IS_NPC(k)))
{
/* this is a PC, display their global variables */
if (k->script && k->script->global_vars)
{
struct trig_var_data *tv;
char uname[MAX_INPUT_LENGTH] = {'\0'};
send_to_char(ch, "\tCPC Global Variables:\tn\r\n");
/* currently, variable context for players is always 0, so it is not
* displayed here. in the future, this might change */
for (tv = k->script->global_vars; tv; tv = tv->next)
{
if (*(tv->value) == UID_CHAR)
{
find_uid_name(tv->value, uname, sizeof(uname));
send_to_char(ch, " %10s: \tC[UID]:\tn %s\r\n", tv->name, uname);
}
else
send_to_char(ch, " %10s: %s\r\n", tv->name, tv->value);
}
}
}
}
static void do_stat_character(struct char_data *ch, struct char_data *k)
{
char buf[MAX_STRING_LENGTH] = {'\0'};
int i, i2, column, found = FALSE, w_type, counter = 0;
struct obj_data *j, *wielded = GET_EQ(ch, WEAR_WIELD_1);
struct follow_type *fol;
clan_rnum c_n;
int c_r, index = 0;
int line_length = 80;
// get some initial info beforehand
if (wielded && GET_OBJ_TYPE(wielded) == ITEM_WEAPON)
w_type = GET_OBJ_VAL(wielded, 3) + TYPE_HIT;
else
{
if (IS_NPC(ch) && ch->mob_specials.attack_type != 0)
w_type = ch->mob_specials.attack_type + TYPE_HIT;
else
w_type = TYPE_HIT;
}
send_to_char(ch,
"\tC=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\tn\r\n");
sprinttype(GET_SEX(k), genders, buf, sizeof(buf));
send_to_char(ch,
"\tC%s %s '\tn%s\tC' IDNum: [\tn%5ld\tC], Loc [\tn%5d\tC/W(\tn%d\tC, \tn%d\tC)], Loadroom : [\tn%5d\tC]\tn\r\n",
buf, (!IS_NPC(k) ? "PC" : (!IS_MOB(k) ? "NPC" : "MOB")),
GET_NAME(k), IS_NPC(k) ? GET_ID(k) : GET_IDNUM(k),
GET_ROOM_VNUM(IN_ROOM(k)), k->coords[0], k->coords[1], IS_NPC(k) ? NOWHERE : GET_LOADROOM(k));
if (IS_MOB(k))
{
send_to_char(ch, "\tCKeyword:\tn %s\tC, VNum: [\tn%5d\tC], RNum: [\tn%5d\tC]\r\n",
k->player.name, GET_MOB_VNUM(k), GET_MOB_RNUM(k));
send_to_char(ch, "\tCL-Des: \tn%s",
k->player.long_descr ? k->player.long_descr : "<None>\r\n");
}
if (!IS_MOB(k))
send_to_char(ch, "\tCTitle:\tn %s\r\n", k->player.title ? k->player.title : "<None>");
send_to_char(ch, "\tCD-Des: \tn%s", k->player.description ? k->player.description : "<None>\r\n");
if (IS_NPC(k))
{
if (GET_RACE(k) >= 0)
send_to_char(ch, "\tCMobile Race:\tn %s ", race_family_types[GET_RACE(k)]);
else
send_to_char(ch, "\tCRace Undefined\tn ");
}
else if (IS_MORPHED(k))
{
send_to_char(ch, "\tCMorphRace:\tn %s ", race_family_types[IS_MORPHED(k)]);
}
else
{
send_to_char(ch, "\tCRace:\tn %s ", RACE_ABBR(k));
}
if (IS_NPC(k))
{
if (GET_SUBRACE(k, 0))
send_to_char(ch, "\tCSub-Race:\tn %s / ",
npc_subrace_types[GET_SUBRACE(k, 0)]);
if (GET_SUBRACE(k, 1))
send_to_char(ch, "%s / ",
npc_subrace_types[GET_SUBRACE(k, 1)]);
if (GET_SUBRACE(k, 2))
send_to_char(ch, "%s ",
npc_subrace_types[GET_SUBRACE(k, 2)]);
send_to_char(ch, "\r\n");
}
send_to_char(ch, "\tCCrntClass:\tn %s ", CLSLIST_NAME(GET_CLASS(k)));
send_to_char(ch, "\tCLvl: [\tn%d\tC] XP: [\tn%d\tC] "
"Algn: [\tn%s(%d)\tC]\tn\r\n",
GET_LEVEL(k), GET_EXP(k),
get_align_by_num(GET_ALIGNMENT(k)), GET_ALIGNMENT(k));
if (!IS_NPC(k))
{
send_to_char(ch, "\tCClass Array:\tn ");
for (i = 0; i < MAX_CLASSES; i++)
{
if (CLASS_LEVEL(k, i))
{
if (counter)
send_to_char(ch, "/");