-
Notifications
You must be signed in to change notification settings - Fork 23
/
act.informative.c
executable file
·7417 lines (6669 loc) · 248 KB
/
act.informative.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.informative.c Part of LuminariMUD *
* Usage: Player-level commands of an informative nature. *
* *
* 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 "screen.h"
#include "constants.h"
#include "dg_scripts.h"
#include "mud_event.h"
#include "mail.h" /**< For the has_mail function */
#include "act.h"
#include "class.h"
#include "race.h"
#include "fight.h"
#include "modify.h"
#include "asciimap.h"
#include "spells.h"
#include "clan.h"
#include "craft.h" // auto crafting quest
#include "wilderness.h"
#include "quest.h" /* so you can identify questmaster mobiles */
#include "feats.h"
#include "assign_wpn_armor.h"
#include "domains_schools.h"
#include "desc_engine.h"
#include "crafts.h"
#include "alchemy.h"
#include "premadebuilds.h"
#include "staff_events.h"
#include "missions.h"
#include "spec_procs.h"
#include "transport.h"
#include "encounters.h"
#include "deities.h"
/* prototypes of local functions */
/* do_diagnose utility functions */
static void diag_char_to_char(struct char_data *i, struct char_data *ch);
/* do_look and do_examine utility functions */
static void do_auto_exits(struct char_data *ch);
static void list_char_to_char(struct char_data *list, struct char_data *ch);
static void list_one_char(struct char_data *i, struct char_data *ch);
static void look_at_char(struct char_data *i, struct char_data *ch);
static void look_at_target(struct char_data *ch, char *arg);
static void look_in_direction(struct char_data *ch, int dir);
static void look_in_obj(struct char_data *ch, char *arg);
/* do_look, do_equipment, do_examine, do_inventory */
static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch);
/* do_where utility functions */
static void perform_immort_where(struct char_data *ch, char *arg);
static void perform_mortal_where(struct char_data *ch, char *arg);
static void print_object_location(int num, struct obj_data *obj, struct char_data *ch, int recur);
/* globals */
int boot_high = 0;
/* file level defines */
/* weapon types */
#define WPT_SIMPLE 1
#define WPT_MARTIAL 2
#define WPT_EXOTIC 3
#define WPT_MONK 4
#define WPT_DRUID 5
#define WPT_BARD 6
#define WPT_ROGUE 7
#define WPT_WIZARD 8
#define WPT_DROW 9
#define WPT_ELF 10
#define WPT_DWARF 11
#define WPT_DUERGAR 11
#define WPT_PSIONICIST 12
#define WPT_SHADOWDANCER 13
#define WPT_ASSASSIN 14
const int eq_ordering_1[NUM_WEARS] = {
WEAR_LIGHT, //<used as light>
WEAR_BADGE, //<worn as a badge>
WEAR_HEAD, //<worn on head>
WEAR_EYES, //<worn on eyes>
WEAR_EAR_R, //<worn in ear>
WEAR_EAR_L, //<worn in ear>
WEAR_FACE, //<worn on face>
WEAR_NECK_1, //<worn around neck>
WEAR_NECK_2, //<worn around neck>
WEAR_BODY, //<worn on body>
WEAR_ABOUT, //<worn about body>
WEAR_AMMO_POUCH, //<worn as ammo pouch>
WEAR_WAIST, //<worn about waist>
WEAR_ARMS, //<worn on arms>
WEAR_WRIST_R, //<worn around wrist>
WEAR_WRIST_L, //<worn around wrist>
WEAR_HANDS, //<worn on hands>
WEAR_FINGER_R, //<worn on finger>
WEAR_FINGER_L, //<worn on finger>
WEAR_WIELD_1, //<wielding/held slots>
WEAR_HOLD_1, //<wielding/held slots>
WEAR_WIELD_OFFHAND, //<wielding/held slots>
WEAR_HOLD_2, //<wielding/held slots>
WEAR_WIELD_2H, //<wielding/held slots>
WEAR_HOLD_2H, //<wielding/held slots>
WEAR_SHIELD, //<worn as shield>
WEAR_LEGS, //<worn on legs>
WEAR_FEET, //<worn on feet>
};
/******* UTILITY FUNCTIONS ***********/
/* function to display some basic info about a mobile that is 'identified' or
victim of 'lore' */
void lore_id_vict(struct char_data *ch, struct char_data *tch)
{
int i = 0;
size_t len = 0;
int count = 0, dcount = 0;
bool has_subrace = false;
char subraces[MEDIUM_STRING] = {'\0'};
if (IS_NPC(tch))
{
if (HAS_FEAT(ch, FEAT_BG_SAGE))
GET_SAGE_MOB_VNUM(ch) = GET_MOB_VNUM(tch);
}
count = snprintf(subraces + len, sizeof(subraces) - len, ", Subrace(s): ");
if (count > 0)
len += count;
if (GET_SUBRACE(tch, 0))
{
count = snprintf(subraces + len, sizeof(subraces) - len, "%s", npc_subrace_types[GET_SUBRACE(tch, 0)]);
if (count > 0)
len += count;
has_subrace = true;
}
if (GET_SUBRACE(tch, 1))
{
count = snprintf(subraces + len, sizeof(subraces) - len, "/%s", npc_subrace_types[GET_SUBRACE(tch, 1)]);
if (count > 0)
len += count;
}
if (GET_SUBRACE(tch, 2))
{
count = snprintf(subraces + len, sizeof(subraces) - len, "/%s", npc_subrace_types[GET_SUBRACE(tch, 2)]);
if (count > 0)
len += count;
}
send_to_char(ch, "Name: %s\r\n", GET_NAME(tch));
if (!IS_NPC(tch))
send_to_char(ch, "%s is %d years, %d months, %d days and %d hours old.\r\n",
GET_NAME(tch), age(tch)->year, age(tch)->month,
age(tch)->day, age(tch)->hours);
send_to_char(ch, "Race: %s%s.\r\n", !IS_NPC(tch) ? CAP(race_list[GET_RACE(tch)].name) : race_family_types[GET_RACE(tch)],
has_subrace ? subraces : "");
if (!AFF_FLAGGED(tch, AFF_HIDE_ALIGNMENT))
send_to_char(ch, "Alignment: %s.\r\n", get_align_by_num(GET_ALIGNMENT(tch)));
if (IS_NPC(tch))
send_to_char(ch, "Class: %s.\r\n", class_list[GET_CLASS(tch)].name);
send_to_char(ch, "Level: %d, Hits: %d/%d, PSP: %d\r\n", GET_LEVEL(tch),
GET_HIT(tch), GET_MAX_HIT(tch), GET_PSP(tch));
send_to_char(ch, "AC: %d, Hitroll: %d, Damroll: %d\r\n",
compute_armor_class(NULL, tch, FALSE, MODE_ARMOR_CLASS_NORMAL),
GET_HITROLL(tch), GET_DAMROLL(tch));
if (IS_NPC(tch))
send_to_char(ch, "Will: %d, Fort: %d, Refl: %d\r\n",
compute_mag_saves(tch, SAVING_WILL, 0), compute_mag_saves(tch, SAVING_FORT, 0), compute_mag_saves(tch, SAVING_REFL, 0));
send_to_char(ch, "Str: %d/%d, Int: %d, Wis: %d, Dex: %d, Con: %d, Cha: %d\r\n",
GET_STR(tch), GET_ADD(tch), GET_INT(tch),
GET_WIS(tch), GET_DEX(tch), GET_CON(tch), GET_CHA(tch));
text_line(ch, "\tYDamage Type Resistance / Vulnerability\tC", 80, '-', '-');
for (i = 0; i < NUM_DAM_TYPES - 1; i++)
{
if (can_dam_be_resisted(i+1))
{
send_to_char(ch, " %-15s: %-4d%% (%-2d) ", damtype_display[i + 1],
compute_damtype_reduction(tch, i + 1), compute_energy_absorb(tch, i + 1));
dcount++;
if (dcount % 2)
send_to_char(ch, "\r\n");
}
}
}
/* special affect that allows you to sense 'aggro' enemies */
void check_dangersense(struct char_data *ch, room_rnum room)
{
struct char_data *tch;
bool danger = FALSE;
if (!AFF_FLAGGED(ch, AFF_DANGERSENSE) || room == NOWHERE)
return;
for (tch = world[room].people; tch && danger == FALSE; tch = tch->next_in_room)
{
if (!IS_NPC(tch))
continue;
if ((MOB_FLAGGED(tch, MOB_AGGRESSIVE)) ||
(MOB_FLAGGED(tch, MOB_AGGR_EVIL) && IS_EVIL(ch)) ||
(MOB_FLAGGED(tch, MOB_AGGR_NEUTRAL) && IS_NEUTRAL(ch)) ||
(MOB_FLAGGED(tch, MOB_AGGR_GOOD) && IS_GOOD(ch)))
danger = TRUE;
}
if (danger)
send_to_char(ch, "\tRYou feel \trdanger\tR there.\tn\r\n");
}
void show_obj_info(struct obj_data *obj, struct char_data *ch)
{
int size = GET_OBJ_SIZE(obj);
int material = GET_OBJ_MATERIAL(obj);
int type = GET_OBJ_TYPE(obj);
int weapon_type = GET_WEAPON_TYPE(obj);
int armor_val = GET_OBJ_VAL(obj, 1);
int i = 0;
/* dummy checks due to old stock items */
if (size < 0 || size >= NUM_SIZES)
size = 0;
if (material < 0 || material >= NUM_MATERIALS)
material = 0;
if (type < 0 || type >= NUM_ITEM_TYPES)
type = 0;
if (weapon_type < 0 || weapon_type >= NUM_WEAPON_TYPES)
weapon_type = 0;
if (armor_val < 0 || armor_val >= NUM_SPEC_ARMOR_TYPES)
armor_val = 0;
/* show object size and material */
send_to_char(ch, "[Size: %s, Material: %s] ", size ? sizes[size] : "???",
material ? material_name[material] : "???");
/* displaying weapon / armor info */
switch (type)
{
case ITEM_WEAPON:
send_to_char(ch, "Weapon: %s ", weapon_type ? weapon_list[weapon_type].name : "???");
/* check load-status of a reloadable weapon (such as crossbow) */
if (is_reloading_weapon(ch, obj, TRUE))
{
send_to_char(ch, "| Loaded ammo: %d ", GET_OBJ_VAL(obj, 5));
}
break;
case ITEM_ARMOR:
send_to_char(ch, "Armor: %s ", armor_val ? armor_list[armor_val].name : "???");
break;
}
/* spec proc system for items */
for (i = 0; i < SPEC_TIMER_MAX; i++)
{
if (GET_OBJ_SPECTIMER(obj, i))
{
send_to_char(ch, "ImbuedPower Cooldown %d: %d hours | ", i, GET_OBJ_SPECTIMER(obj, i));
}
}
}
/* Subcommands */
/* For show_obj_to_char 'mode'. /-- arbitrary */
#define SHOW_OBJ_LONG 0
#define SHOW_OBJ_SHORT 1
#define SHOW_OBJ_ACTION 2
void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode, int mxp_type)
{
char keyword[100], keyword1[100], sendcmd[20];
int found = 0, item_num = 0;
struct char_data *temp;
struct obj_data *temp_obj;
// mxp_type 1 = do_inventory
// mxp_type 2 = do_equipment
// maybe change these to defines in protocol.h or something
// these will be used to give click options i.e. click an item in inventory
// to equip it, or right click with context menu, to equip/drop/lore/etc.
if (!obj || !ch)
{
log("SYSERR: NULL pointer in show_obj_to_char(): obj=%p ch=%p", obj, ch);
/* SYSERR_DESC: Somehow a NULL pointer was sent to show_obj_to_char() in
* either the 'obj' or the 'ch' variable. The error will indicate which
* was NULL by listing both of the pointers passed to it. This is often a
* difficult one to trace, and may require stepping through a debugger. */
return;
}
if ((mode == 0) && obj->description)
{
if (!GET_OBJ_VAL(obj, 1) == 0 || OBJ_SAT_IN_BY(obj))
{
temp = OBJ_SAT_IN_BY(obj);
for (temp = OBJ_SAT_IN_BY(obj); temp; temp = NEXT_SITTING(temp))
{
if (temp == ch)
found++;
}
if (found)
{
send_to_char(ch, "You are %s upon %s.", GET_POS(ch) == POS_SITTING ? "sitting" : "resting", obj->short_description);
goto end;
}
}
}
switch (mode)
{
case SHOW_OBJ_LONG:
/* Hide objects starting with . from non-holylighted people. - Elaseth */
if (*obj->description == '.' && (IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_HOLYLIGHT)))
return;
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
{
send_to_char(ch, "[%d] ", GET_OBJ_VNUM(obj));
if (SCRIPT(obj))
{
if (!TRIGGERS(SCRIPT(obj))->next)
send_to_char(ch, "[T%d] ", GET_TRIG_VNUM(TRIGGERS(SCRIPT(obj))));
else
send_to_char(ch, "[TRIGS] ");
}
}
send_to_char(ch, "%s", CCGRN(ch, C_NRM));
send_to_char(ch, "%s", obj->description);
break;
case SHOW_OBJ_SHORT:
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
{
send_to_char(ch, "[%d] ", GET_OBJ_VNUM(obj));
if (SCRIPT(obj))
{
if (!TRIGGERS(SCRIPT(obj))->next)
send_to_char(ch, "[T%d] ", GET_TRIG_VNUM(TRIGGERS(SCRIPT(obj))));
else
send_to_char(ch, "[TRIGS] ");
}
}
if (mxp_type != 0)
{
one_argument(obj->name, keyword, sizeof(keyword));
switch (mxp_type)
{
case 1: // inventory
// loop through to ensure correct item, i.e. 2.dagger, 3.armor, etc.
for (temp_obj = ch->carrying; temp_obj; temp_obj = temp_obj->next_content)
{
// check if the temp_obj contains keyword in the name list
if (isname(keyword, temp_obj->name))
{
if (temp_obj->short_description == obj->short_description)
// this is the item they are trying to interact with
// or at least has the same short description
break;
else
item_num++;
}
}
if (item_num > 0)
{
snprintf(keyword1, sizeof(keyword1), "%d.%s", (item_num + 1), keyword);
strlcpy(keyword, keyword1, sizeof(keyword));
}
if (GET_OBJ_TYPE(obj) == ITEM_WEAPON)
strlcpy(sendcmd, "wield", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_SCROLL)
strlcpy(sendcmd, "recite", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_POTION)
strlcpy(sendcmd, "quaff", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_ARMOR)
strlcpy(sendcmd, "wear", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_WORN)
strlcpy(sendcmd, "wear", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_FOOD)
strlcpy(sendcmd, "eat", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_DRINKCON)
strlcpy(sendcmd, "drink", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_NOTE)
strlcpy(sendcmd, "read", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_SPELLBOOK)
strlcpy(sendcmd, "look in", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER)
strlcpy(sendcmd, "look in", sizeof(sendcmd));
else if (GET_OBJ_TYPE(obj) == ITEM_AMMO_POUCH)
strlcpy(sendcmd, "look in", sizeof(sendcmd));
else
strlcpy(sendcmd, "hold", sizeof(sendcmd));
send_to_char(ch, "\t<send href='%s %s|drop %s|eat %s|hold %s|lore %s' hint='use/equip %s|drop %s|eat %s|hold %s|lore %s'>%s\t</send>", sendcmd, keyword,
keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword, obj->short_description);
break;
case 2: // equipment
send_to_char(ch, "\t<send href='remove %s'>%s\t</send>", keyword, obj->short_description);
break;
}
}
else
{
send_to_char(ch, "%s", obj->short_description);
}
break;
case SHOW_OBJ_ACTION:
switch (GET_OBJ_TYPE(obj))
{
case ITEM_NOTE:
if (obj->action_description)
{
char notebuf[MAX_NOTE_LENGTH + 64];
snprintf(notebuf, sizeof(notebuf), "There is something written on it:\r\n\r\n%s", obj->action_description);
page_string(ch->desc, notebuf, TRUE);
}
else
send_to_char(ch, "It's blank.\r\n");
return;
case ITEM_DRINKCON:
send_to_char(ch, "It looks like a drink container.");
break;
case ITEM_BLUEPRINT:
show_craft(ch, get_craft_from_id(GET_OBJ_VAL(obj, 0)), 0);
break;
default:
send_to_char(ch, "You see nothing special..");
break;
}
/* obj size, material, weapon/armor */
show_obj_info(obj, ch);
break;
default:
log("SYSERR: Bad display mode (%d) in show_obj_to_char().", mode);
/* SYSERR_DESC: show_obj_to_char() has some predefined 'mode's (argument
* #3) to tell it what to display to the character when it is called. If
* the mode is not one of these, it will output this error, and indicate
* what mode was passed to it. To correct it, you will need to find the
* call with the incorrect mode and change it to an acceptable mode. */
return;
}
end:
show_obj_modifiers(obj, ch);
send_to_char(ch, "\r\n");
}
/* default is just showing object flags here, we've added:
1) special, such as poison
2) size */
static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch)
{
if (OBJ_FLAGGED(obj, ITEM_INVISIBLE))
send_to_char(ch, " \tw(invisible)\tn");
if (OBJ_FLAGGED(obj, ITEM_FROST))
send_to_char(ch, " \tB(frost)\tn");
if (OBJ_FLAGGED(obj, ITEM_FLAMING))
send_to_char(ch, " \tR(flaming)\tn");
if (obj->weapon_poison.poison)
send_to_char(ch, " \tG(poisoned)\tn");
if (OBJ_FLAGGED(obj, ITEM_BLESS) && (AFF_FLAGGED(ch, AFF_DETECT_ALIGN) || HAS_FEAT(ch, FEAT_AURA_OF_GOOD)))
send_to_char(ch, " \tn..It glows \tBblue\tn!");
if (OBJ_FLAGGED(obj, ITEM_NODROP) && HAS_FEAT(ch, FEAT_AURA_OF_EVIL))
send_to_char(ch, " \tn..It glows \tRred\tn!");
if (OBJ_FLAGGED(obj, ITEM_MAGIC) && AFF_FLAGGED(ch, AFF_DETECT_MAGIC))
send_to_char(ch, " \tn..It glows \tYyellow\tn!");
if (OBJ_FLAGGED(obj, ITEM_GLOW))
send_to_char(ch, " \tW..It has a soft glowing aura!\tn");
if (OBJ_FLAGGED(obj, ITEM_HUM))
send_to_char(ch, " \tn..It emits a faint \tChumming\tn sound!");
if (GET_OBJ_TYPE(obj) == ITEM_LIGHT && GET_OBJ_VAL(obj, 2) == 0)
send_to_char(ch, " \tD(burned out)\tn");
}
void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show, int mxp_type)
{
list_obj_to_char_full(list, ch, mode, show, mxp_type, false);
}
void list_obj_to_char_full(struct obj_data *list, struct char_data *ch, int mode, int show, int mxp_type, bool can_see_always)
{
struct obj_data *i = NULL, *j = NULL, *display = NULL;
bool found = FALSE;
int num = -1;
/* Loop through the list of objects */
for (i = list; i; i = i->next_content)
{
num = 0;
/* Check the list to see if we've already counted this object */
for (j = list; j != i; j = j->next_content)
if (
(j->short_description == i->short_description && j->name == i->name) ||
(!strcmp(j->short_description, i->short_description) && !strcmp(j->name, i->name)))
break; /* found a matching object */
if (j != i)
continue; /* we counted object i earlier in the list */
if ((display = j = i) != NULL)
{
/* Count matching objects, including this one */
for (display = j = i; j; j = j->next_content)
/* This if-clause should be exactly the same as the one in the loop above */
if ((j->short_description == i->short_description && j->name == i->name) ||
(!strcmp(j->short_description, i->short_description) && !strcmp(j->name, i->name)))
if (CAN_SEE_OBJ(ch, j) || can_see_always /*|| (!AFF_FLAGGED(ch, AFF_BLIND) && OBJ_FLAGGED(j, ITEM_GLOW))*/)
{
/* added the ability for players to see glowing items in their inventory in the dark
* as long as they are not blind! maybe add this to CAN_SEE_OBJ macro? */
++num;
/* If the original item can't be seen, switch it for this one */
if (display == i && !CAN_SEE_OBJ(ch, display))
display = j;
}
/* When looking in room, hide objects starting with '.', except for holylight */
if (num > 0 && (mode != SHOW_OBJ_LONG || *display->description != '.' ||
(!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT))))
{
if (mode == SHOW_OBJ_LONG)
send_to_char(ch, "%s", CCGRN(ch, C_NRM));
if (num != 1)
send_to_char(ch, "(%2i) ", num);
show_obj_to_char(display, ch, mode, mxp_type);
send_to_char(ch, "%s", CCNRM(ch, C_NRM));
found = TRUE;
}
} /* end loop */
}
if (!found && show)
send_to_char(ch, " Nothing.\r\n");
}
static void diag_char_to_char(struct char_data *i, struct char_data *ch)
{
const struct
{
byte percent;
const char *text;
} diagnosis[] = {
{100, "is in excellent condition."},
{90, "has a few scratches."},
{75, "has some small wounds and bruises."},
{50, "has quite a few wounds."},
{30, "has some big nasty wounds and scratches."},
{15, "looks pretty hurt."},
{0, "is in awful condition."},
{-1, "is bleeding awfully from big wounds."},
};
if (!ch || !i) return;
int percent, ar_index;
char *pers = strdup(PERS(i, ch));
int is_disguised = GET_DISGUISE_RACE(i);
if (GET_MAX_HIT(i) > 0)
percent = (100 * GET_HIT(i)) / GET_MAX_HIT(i);
else
percent = -1; /* How could MAX_HIT be < 1?? */
/* nab diagnosis message */
for (ar_index = 0; diagnosis[ar_index].percent >= 0; ar_index++)
if (percent >= diagnosis[ar_index].percent)
break;
/* time to display! */
/* show disguise race info */
if (is_disguised)
{
send_to_char(ch, "%s \tn[%s %s\tn] %s\r\n", race_list[is_disguised].type,
size_names[GET_SIZE(i)], RACE_ABBR(i), diagnosis[ar_index].text);
/* PC race info */
}
else if (!IS_NPC(i))
{
send_to_char(ch, "%s \tn[%s %s\tn] %s\r\n", CAP(pers), size_names[GET_SIZE(i)],
RACE_ABBR(i), diagnosis[ar_index].text);
/* NPC with no race info */
}
else if (IS_NPC(i) && GET_RACE(i) <= RACE_TYPE_UNKNOWN)
{
send_to_char(ch, "%s %s\r\n", CAP(pers),
diagnosis[ar_index].text);
/* NPC with no sub-race info */
}
else if (IS_NPC(i) && GET_SUBRACE(i, 0) <= SUBRACE_UNKNOWN && GET_SUBRACE(i, 1) <= SUBRACE_UNKNOWN && GET_SUBRACE(i, 2) <= SUBRACE_UNKNOWN)
{
send_to_char(ch, "%s \tn[%s %s\tn] %s\r\n", CAP(pers),
size_names[GET_SIZE(i)], RACE_ABBR(i), diagnosis[ar_index].text);
/* NPC */
}
else
{
send_to_char(ch, "%s \tn[%s %s/%s/%s %s\tn] %s\r\n", CAP(pers),
size_names[GET_SIZE(i)], npc_subrace_abbrevs[GET_SUBRACE(i, 0)],
npc_subrace_abbrevs[GET_SUBRACE(i, 1)],
npc_subrace_abbrevs[GET_SUBRACE(i, 2)],
RACE_ABBR(i), diagnosis[ar_index].text);
}
/* some spell and spell-like affects that we want to show up */
/* Some sort of automated system is needed here, as part of the affect system
to facilitate these kinds of messages so that we don't have to edit so many
things when we add an affect. - JTM 15/12/17 */
if (affected_by_spell(i, SPELL_BARKSKIN))
act("$s skin appears to be made of bark.", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, SPELL_STONESKIN))
act("$s skin appears to be made of stone.", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, SPELL_IRONSKIN))
act("$s skin appears to be made of iron.", FALSE, i, 0, ch, TO_VICT);
if (TRLX_PSN_VAL(i) > 0 && TRLX_PSN_VAL(i) < NUM_SPELLS)
act("$s claws are dripping with \tgpoison\tn.", FALSE, i, 0, ch, TO_VICT);
/* clean up */
free(pers);
pers = NULL;
}
/*
* These next functions/procedures are where we need to implement the customized color system!
* To start with, just providing sane colors for things like room descriptions would go a long way.
*/
static void look_at_char(struct char_data *i, struct char_data *ch)
{
int j, found, is_disguised = FALSE;
char buf[MAX_INPUT_LENGTH] = {'\0'};
if (!ch->desc)
return;
if (GET_DISGUISE_RACE(i))
is_disguised = GET_DISGUISE_RACE(i);
if (is_disguised)
{
; /*todo, put in descriptions!*/
}
else if (i->player.description)
send_to_char(ch, "%s", i->player.description);
else
act("You see nothing special about $m.", FALSE, i, 0, ch, TO_VICT);
if (IS_NPC(i) && MOB_FLAGGED(i, MOB_IS_OBJ))
return;
diag_char_to_char(i, ch);
// mounted
if (RIDING(i) && RIDING(i)->in_room == i->in_room)
{
if (RIDING(i) == ch)
act("$e is mounted on you.", FALSE, i, 0, ch, TO_VICT);
else
{
snprintf(buf, sizeof(buf), "$e is mounted upon %s.", PERS(RIDING(i), ch));
act(buf, FALSE, i, 0, ch, TO_VICT);
}
}
else if (RIDDEN_BY(i) && RIDDEN_BY(i)->in_room == i->in_room)
{
if (RIDDEN_BY(i) == ch)
act("You are mounted upon $m.", FALSE, i, 0, ch, TO_VICT);
else
{
snprintf(buf, sizeof(buf), "$e is mounted by %s.", PERS(RIDDEN_BY(i), ch));
act(buf, FALSE, i, 0, ch, TO_VICT);
}
}
found = FALSE;
for (j = 0; !found && j < NUM_WEARS; j++)
if (GET_EQ(i, j) && CAN_SEE_OBJ(ch, GET_EQ(i, j)))
found = TRUE;
if (found && !is_disguised)
{
send_to_char(ch, "\r\n"); /* act() does capitalization. */
act("$n is using:", FALSE, i, 0, ch, TO_VICT);
for (j = 0; j < NUM_WEARS; j++)
{
if (GET_EQ(i, eq_ordering_1[j]) && CAN_SEE_OBJ(ch, GET_EQ(i, eq_ordering_1[j])))
{
send_to_char(ch, "%s", wear_where[eq_ordering_1[j]]);
show_obj_to_char(GET_EQ(i, eq_ordering_1[j]), ch, SHOW_OBJ_SHORT, 0);
}
}
}
if (ch != i && (IS_ROGUE(ch) || GET_LEVEL(ch) >= LVL_IMMORT))
{
act("\r\nYou attempt to peek at $s inventory:", FALSE, i, 0, ch, TO_VICT);
list_obj_to_char(i->carrying, ch, SHOW_OBJ_SHORT, TRUE, 0);
}
}
static void list_one_char(struct char_data *i, struct char_data *ch)
{
struct obj_data *furniture;
char *short_descr;
const char *const positions[NUM_POSITIONS] = {
" is lying here, dead.",
" is lying here, mortally wounded.",
" is lying here, incapacitated.",
" is lying here, stunned.",
" is sleeping here.",
" is reclining here.",
" is resting here.",
" is sitting here.",
"!FIGHTING!", /* message elsewhere */
" is standing here."};
/* start display of info BEFORE short-descrip/name/title */
/* npcs: show vnum / trig info */
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
{
if (IS_NPC(i))
send_to_char(ch, "[%d] ", GET_MOB_VNUM(i));
send_to_char(ch, "[%2d] ", GET_LEVEL(i));
if (SCRIPT(i) && TRIGGERS(SCRIPT(i)))
{
if (!TRIGGERS(SCRIPT(i))->next)
send_to_char(ch, "[T%d] ", GET_TRIG_VNUM(TRIGGERS(SCRIPT(i))));
else
send_to_char(ch, "[TRIGS] ");
}
}
/* pcs: show if groupped */
if (!IS_NPC(i) && GROUP(i))
{
if (GROUP(i) == GROUP(ch))
send_to_char(ch, "(%s) ",
GROUP_LEADER(GROUP(i)) == i ? "leader" : "group");
else
send_to_char(ch, "%s(%s%s%s) ", CCNRM(ch, C_NRM), CBRED(ch, C_NRM),
GROUP_LEADER(GROUP(i)) == i ? "leader" : "group",
CCNRM(ch, C_NRM));
}
/* npcs: default position, not fighting */
if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i) &&
!FIGHTING(i))
{
if (AFF_FLAGGED(i, AFF_INVISIBLE))
send_to_char(ch, "*");
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOCON) && IS_NPC(i) && !MOB_FLAGGED(i, MOB_IS_OBJ))
{
int level_diff = GET_LEVEL(i) - GET_LEVEL(ch);
if (level_diff < -5)
{
send_to_char(ch, "[--] ");
}
else if (level_diff < 0)
{
send_to_char(ch, "[%d] ", level_diff);
}
else if (level_diff == 0)
{
send_to_char(ch, "[==] ");
}
else if (level_diff < 6)
{
send_to_char(ch, "[+%d] ", level_diff);
}
else
{
send_to_char(ch, "[!!] ");
}
}
if (IS_EVIL(i) && !AFF_FLAGGED(i, AFF_HIDE_ALIGNMENT))
{
if (AFF_FLAGGED(ch, AFF_DETECT_ALIGN) || HAS_FEAT(ch, FEAT_DETECT_EVIL) || HAS_FEAT(ch, FEAT_AURA_OF_EVIL))
{
send_to_char(ch, "\tR(Red Aura)\tn ");
}
}
else if (IS_GOOD(i) && !AFF_FLAGGED(i, AFF_HIDE_ALIGNMENT))
{
if (AFF_FLAGGED(ch, AFF_DETECT_ALIGN) || HAS_FEAT(ch, FEAT_DETECT_GOOD) || HAS_FEAT(ch, FEAT_AURA_OF_GOOD))
{
send_to_char(ch, "\tB(Blue Aura)\tn ");
}
}
if (IS_NPC(i) && (i->mob_specials.quest))
send_to_char(ch, "\tn(\tR!\tn) ");
if (IS_NPC(i) && (GET_MOB_SPEC(i) == questmaster))
send_to_char(ch, "\tn(\tY!\tn) ");
if (strstr(i->player.long_descr, "\n"))
send_to_char(ch, "\ty%s", i->player.long_descr);
else
send_to_char(ch, "\ty%s\r\n", i->player.long_descr);
if (PRF_FLAGGED(i, PRF_NON_ROLEPLAYER))
act("...$e is a non-roleplayer.", FALSE, i, 0, ch, TO_VICT);
if (AFF_FLAGGED(i, AFF_SANCTUARY))
act("...$e glows with a bright light!", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, SPELL_BANISHING_BLADE))
act("...a green blade of pure energy dances at $s side!", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, SPELL_GREATER_BLACK_TENTACLES))
act("...$e is being curshed by huge, black tentacles sprouting from the ground!", FALSE, i, 0, ch, TO_VICT);
else if (affected_by_spell(i, SPELL_BLACK_TENTACLES))
act("...$e is being curshed by large, black tentacles sprouting from the ground!", FALSE, i, 0, ch, TO_VICT);
if (AFF_FLAGGED(i, AFF_BLIND) && GET_LEVEL(i) < LVL_IMMORT)
act("...$e is groping around blindly!", FALSE, i, 0, ch, TO_VICT);
if (AFF_FLAGGED(i, AFF_FAERIE_FIRE))
act("...$e is surrounded by a pale blue light!", FALSE, i, 0, ch, TO_VICT);
if (KNOWS_DISCOVERY(i, ALC_DISC_VESTIGIAL_ARM))
act("...$e has an additional arm on $s torso.", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, SKILL_DRHRT_WINGS))
{
char wings[150];
snprintf(wings, sizeof(wings), "...$e has two large %s wings sprouting from $s back.", DRCHRTLIST_NAME(GET_BLOODLINE_SUBTYPE(i)));
act(wings, FALSE, i, 0, ch, TO_VICT);
}
else if (KNOWS_DISCOVERY(i, ALC_DISC_WINGS))
{
act("...$e has two large wings sprouting from $s back.", FALSE, i, 0, ch, TO_VICT);
}
if (affected_by_spell(i, PSIONIC_OAK_BODY))
act("...$s skin is like that of an oak tree.", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, PSIONIC_BODY_OF_IRON))
act("...$s skin is like a sheet of think iron.", FALSE, i, 0, ch, TO_VICT);
return;
/* npcs: for non fighting mobiles */
}
else if (!MOB_CAN_FIGHT(i) && i->player.long_descr)
{
if (AFF_FLAGGED(i, AFF_INVISIBLE))
send_to_char(ch, "*");
if (IS_EVIL(i) && !AFF_FLAGGED(i, AFF_HIDE_ALIGNMENT))
{
if (AFF_FLAGGED(ch, AFF_DETECT_ALIGN) || HAS_FEAT(ch, FEAT_DETECT_EVIL) || HAS_FEAT(ch, FEAT_AURA_OF_EVIL))
{
send_to_char(ch, "\tR(Red Aura)\tn ");
}
}
else if (IS_GOOD(i) && !AFF_FLAGGED(i, AFF_HIDE_ALIGNMENT))
{
if (AFF_FLAGGED(ch, AFF_DETECT_ALIGN) || HAS_FEAT(ch, FEAT_DETECT_GOOD) || HAS_FEAT(ch, FEAT_AURA_OF_GOOD))
{
send_to_char(ch, "\tB(Blue Aura)\tn ");
}
}
send_to_char(ch, "%s", i->player.long_descr);
if (PRF_FLAGGED(i, PRF_NON_ROLEPLAYER))
act("...$e is a non-roleplayer.", FALSE, i, 0, ch, TO_VICT);
if (AFF_FLAGGED(i, AFF_SANCTUARY))
act("...$e glows with a bright light!", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, SPELL_BANISHING_BLADE))
act("...a green blade of pure energy dances at $s side!", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, SPELL_GREATER_BLACK_TENTACLES))
act("...$e is being curshed by huge, black tentacles sprouting from the ground!", FALSE, i, 0, ch, TO_VICT);
else if (affected_by_spell(i, SPELL_BLACK_TENTACLES))
act("...$e is being curshed by large, black tentacles sprouting from the ground!", FALSE, i, 0, ch, TO_VICT);
else if (affected_by_spell(i, WARLOCK_CHILLING_TENTACLES))
act("...$e is being curshed by large, chilling black tentacles sprouting from the ground!", FALSE, i, 0, ch, TO_VICT);
if (AFF_FLAGGED(i, AFF_BLIND) && GET_LEVEL(i) < LVL_IMMORT)
act("...$e is groping around blindly!", FALSE, i, 0, ch, TO_VICT);
if (AFF_FLAGGED(i, AFF_FAERIE_FIRE))
act("...$e is surrounded by a pale blue light!", FALSE, i, 0, ch, TO_VICT);
if (KNOWS_DISCOVERY(i, ALC_DISC_VESTIGIAL_ARM))
act("...$e has an additional arm on $s torso.", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, SKILL_DRHRT_WINGS))
{
char wings[150];
snprintf(wings, sizeof(wings), "...$e has two large %s wings sprouting from $s back.", DRCHRTLIST_NAME(GET_BLOODLINE_SUBTYPE(i)));
act(wings, FALSE, i, 0, ch, TO_VICT);
}
else if (KNOWS_DISCOVERY(i, ALC_DISC_WINGS))
{
act("...$e has two large wings sprouting from $s back.", FALSE, i, 0, ch, TO_VICT);
}
if (affected_by_spell(i, PSIONIC_OAK_BODY))
act("...$s skin is like that of an oak tree.", FALSE, i, 0, ch, TO_VICT);
if (affected_by_spell(i, PSIONIC_BODY_OF_IRON))
act("...$s skin is like a sheet of think iron.", FALSE, i, 0, ch, TO_VICT);
return;
}
/* END display of info BEFORE short-descrip/name/title */
/* start display of "middle": short-descrip/name/title etc */
/* npc: send short descrip */
if (IS_NPC(i))
{
short_descr = strdup(i->player.short_descr);
send_to_char(ch, "%s", CAP(short_descr));
free(short_descr);
short_descr = NULL;
/* pc: name/title if not disguise, otherwise disguise info */
}
else
{
if (!GET_DISGUISE_RACE(i))
send_to_char(ch, "\tn[%s] %s", RACE_ABBR(i),
// i->player.name, // This is before we switched to a title system containing the character's name
// *GET_TITLE(i) ? " " : "",
GET_TITLE(i));
else if (AFF_FLAGGED(i, AFF_WILD_SHAPE))
{
char *an_a, *race_name;
an_a = strdup(AN(race_list[GET_DISGUISE_RACE(i)].type));
race_name = strdup(race_list[GET_DISGUISE_RACE(i)].type);
*race_name = LOWER(*race_name);
send_to_char(ch, "%s %s", CAP(an_a), race_name);
free(an_a);
free(race_name);
an_a = NULL;
race_name = NULL;
}
else
{
char *a_an;
a_an = strdup(AN(race_list[GET_DISGUISE_RACE(i)].type));
send_to_char(ch, "%s %s", CAP(a_an), race_list[GET_DISGUISE_RACE(i)].type);
free(a_an);
a_an = NULL;
}
}
/* end display of "middle": short-descrip/name/title etc */
/* start display of "ebd": info AFTER short-descrip/name/title etc */
if (AFF_FLAGGED(i, AFF_INVISIBLE))
send_to_char(ch, " (invisible)");
if (AFF_FLAGGED(i, AFF_HIDE))
send_to_char(ch, " (hidden)");
if (!IS_NPC(i) && !i->desc)
send_to_char(ch, " (linkless)");
if (!IS_NPC(i) && PLR_FLAGGED(i, PLR_WRITING))
send_to_char(ch, " (writing)");
if (!IS_NPC(i) && PRF_FLAGGED(i, PRF_BUILDWALK))
send_to_char(ch, " (buildwalk)");
if (!IS_NPC(i) && PRF_FLAGGED(i, PRF_AFK))
send_to_char(ch, " (AFK)");
if (char_has_mud_event(i, eBARDIC_PERFORMANCE))
send_to_char(ch, " (performing)");
if (char_has_mud_event(i, eTAUNTED))
send_to_char(ch, " (taunted)");
if (char_has_mud_event(i, eINTIMIDATED))
send_to_char(ch, " (intimidated)");
if (char_has_mud_event(i, eVANISH))
send_to_char(ch, " (vanished)");
if (RIDING(i) && RIDING(i)->in_room == i->in_room)
{
send_to_char(ch, " is here, mounted upon ");
if (RIDING(i) == ch)
send_to_char(ch, "you");
else