-
Notifications
You must be signed in to change notification settings - Fork 5
/
act_other.c
1355 lines (1224 loc) · 40.5 KB
/
act_other.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.other.c , Implementation of commands. Part of DIKUMUD
* Usage : Other commands.
* Copyright (C) 1990, 1991 - see 'license.doc' for complete information.
*/
#include <stdio.h>
#include <stdlib.h>
/* #include <unistd.h> */
#include <sys/types.h>
#include <string.h>
#include <ctype.h>
#include "global.h"
#include "bug.h"
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "handler.h"
#include "db.h"
#include "spells.h"
#include "mudlimits.h"
#include "spell_parser.h"
#include "reception.h"
#include "multiclass.h"
#include "fight.h"
#include "spec_procs.h"
#include "act_skills.h"
#include "act_comm.h"
#include "modify.h"
#define _ACT_OTHER_C
#include "act_other.h"
int do_gain(struct char_data *ch, const char *argument, int cmd)
{
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
return TRUE;
}
int do_guard(struct char_data *ch, const char *argument, int cmd)
{
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (!IS_NPC(ch) || IS_SET(ch->specials.act, ACT_POLYSELF))
{
cprintf(ch, "Sorry. you can't just put your brain on autopilot!\r\n");
return TRUE;
}
if (IS_SET(ch->specials.act, ACT_GUARDIAN))
{
act("$n relaxes.", FALSE, ch, 0, 0, TO_ROOM);
cprintf(ch, "You relax.\r\n");
REMOVE_BIT(ch->specials.act, ACT_GUARDIAN);
}
else
{
SET_BIT(ch->specials.act, ACT_GUARDIAN);
act("$n alertly watches you.", FALSE, ch, 0, 0, TO_ROOM);
cprintf(ch, "You snap to attention\r\n");
}
return TRUE;
}
int do_junk(struct char_data *ch, const char *argument, int cmd)
{
char arg[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
char newarg[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
struct obj_data *tmp_object = NULL;
/*
* struct obj_data *old_object = NULL;
*/
int num = 0;
int p = 0;
int count = 0;
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
/*
* get object name & verify
*/
only_argument(argument, arg);
if (*arg)
{
if (getall(arg, newarg) != FALSE)
{
num = -1;
strlcpy(arg, newarg, MAX_INPUT_LENGTH);
}
else if ((p = getabunch(arg, newarg)) != FALSE)
{
num = p;
strlcpy(arg, newarg, MAX_INPUT_LENGTH);
}
else
{
num = 1;
}
count = 0;
while (num != 0)
{
tmp_object = get_obj_in_list_vis(ch, arg, ch->carrying);
if (tmp_object)
{
/*
* old_object = tmp_object;
*/
obj_from_char(tmp_object);
extract_obj(tmp_object);
if (num > 0)
num--;
count++;
}
else
{
if (count > 1)
{
act("You junk %s (%d).\r\n", 1, ch, 0, 0, TO_CHAR, arg, count);
act("$n junks %s.\r\n", 1, ch, 0, 0, TO_ROOM, arg);
}
else if (count == 1)
{
act("You junk %s \r\n", 1, ch, 0, 0, TO_CHAR, arg);
act("$n junks %s.\r\n", 1, ch, 0, 0, TO_ROOM, arg);
}
else
{
cprintf(ch, "You don't have anything like that\r\n");
}
return TRUE;
}
}
}
else
{
cprintf(ch, "Junk what?");
return TRUE;
}
return TRUE;
}
int do_qui(struct char_data *ch, const char *argument, int cmd)
{
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
cprintf(ch, "You have to write quit - no less, to quit!\r\n");
return TRUE;
}
int do_title(struct char_data *ch, const char *argument, int cmd)
{
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_NPC(ch) || !ch->desc)
return TRUE;
for (; isspace(*argument); argument++)
;
if (*argument)
{
cprintf(ch, "Your title has been set to : <%s>\r\n", argument);
ch->player.title = strdup(argument);
}
return TRUE;
}
int do_quit(struct char_data *ch, const char *argument, int cmd)
{
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_NPC(ch) || !ch->desc)
return TRUE;
if (GET_POS(ch) == POSITION_FIGHTING)
{
cprintf(ch, "No way! You are fighting.\r\n");
return TRUE;
}
if (GET_POS(ch) < POSITION_STUNNED)
{
cprintf(ch, "You die before your time!\r\n");
die(ch);
return TRUE;
}
if (MOUNTED(ch))
{
Dismount(ch, MOUNTED(ch), POSITION_STANDING);
}
act("Goodbye, friend.. Come back soon!", FALSE, ch, 0, 0, TO_CHAR);
act("$n has left the game.", TRUE, ch, 0, 0, TO_ROOM);
GET_HOME(ch) = 3008;
zero_rent(ch);
extract_char(ch); /* Char is saved in extract char */
return TRUE;
}
int do_save(struct char_data *ch, const char *argument, int cmd)
{
struct obj_cost cost;
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_NPC(ch))
return TRUE;
cprintf(ch, "Saving %s.\r\n", GET_NAME(ch));
recep_offer(ch, NULL, &cost);
new_save_equipment(ch, &cost, FALSE);
save_obj(ch, &cost, FALSE);
save_char(ch, NOWHERE);
return TRUE;
}
int do_not_here(struct char_data *ch, const char *argument, int cmd)
{
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
cprintf(ch, "Sorry, but you cannot do that here!\r\n");
return TRUE;
}
int do_sneak(struct char_data *ch, const char *argument, int cmd)
{
int percent_chance = 0;
struct affected_type af;
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_AFFECTED(ch, AFF_SNEAK))
{
affect_from_char(ch, SKILL_SNEAK);
if (IS_AFFECTED(ch, AFF_HIDE))
REMOVE_BIT(ch->specials.affected_by, AFF_HIDE);
cprintf(ch, "You are no longer sneaky.\r\n");
return TRUE;
}
cprintf(ch, "Ok, you'll try to move silently for a while.\r\n");
cprintf(ch, "And you attempt to hide yourself.\r\n");
percent_chance = number(1, 101); /* 101% is a complete failure */
if (percent_chance > ch->skills[SKILL_SNEAK].learned + dex_app_skill[(int)GET_DEX(ch)].sneak)
return TRUE;
if (ch->skills[SKILL_SNEAK].learned < 50)
ch->skills[SKILL_SNEAK].learned += 2;
SET_BIT(ch->specials.affected_by, AFF_HIDE);
af.type = SKILL_SNEAK;
af.duration = GET_LEVEL(ch, BestThiefClass(ch));
af.modifier = 0;
af.location = APPLY_NONE;
af.bitvector = AFF_SNEAK;
affect_to_char(ch, &af);
return TRUE;
}
int do_hide(struct char_data *ch, const char *argument, int cmd)
{
int percent_chance = 0;
struct affected_type af;
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
cprintf(ch, "Ok, you crawl into a dark corner and lurk.\r\n");
if (IS_AFFECTED(ch, AFF_SNEAK))
affect_from_char(ch, SKILL_SNEAK);
if (IS_AFFECTED(ch, AFF_HIDE))
REMOVE_BIT(ch->specials.affected_by, AFF_HIDE);
percent_chance = number(1, 101); /* 101% is a complete failure */
if (percent_chance > ch->skills[SKILL_SNEAK].learned + dex_app_skill[(int)GET_DEX(ch)].sneak)
return TRUE;
if (ch->skills[SKILL_SNEAK].learned < 50)
ch->skills[SKILL_SNEAK].learned += 2;
SET_BIT(ch->specials.affected_by, AFF_HIDE);
af.type = SKILL_SNEAK;
af.duration = GET_LEVEL(ch, BestThiefClass(ch));
af.modifier = 0;
af.location = APPLY_NONE;
af.bitvector = AFF_SNEAK;
affect_to_char(ch, &af);
return TRUE;
}
int do_steal(struct char_data *ch, const char *argument, int cmd)
{
struct char_data *victim = NULL;
struct obj_data *obj = NULL;
char victim_name[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
char obj_name[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
char buf[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
int percent_chance = 0;
int gold = 0;
int eq_pos = 0;
char ohoh = FALSE;
struct room_data *rp = NULL;
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (check_peaceful(ch, "What if he caught you?\r\n"))
return TRUE;
argument = one_argument(argument, obj_name);
only_argument(argument, victim_name);
if (!(victim = get_char_room_vis(ch, victim_name)))
{
cprintf(ch, "Steal what from who?\r\n");
return TRUE;
}
else if (victim == ch)
{
cprintf(ch, "Come on now, that's rather stupid!\r\n");
return TRUE;
}
if (!CheckKill(ch, victim))
return TRUE;
if ((!victim->desc) && (IS_PC(victim)))
return TRUE;
/*
* 101% is a complete failure
*/
percent_chance = number(1, 101) - dex_app_skill[(int)GET_DEX(ch)].p_pocket;
if (GET_POS(victim) < POSITION_SLEEPING)
percent_chance = -1; /* ALWAYS SUCCESS */
percent_chance += GetTotLevel(victim);
if (GetMaxLevel(victim) > MAX_MORT)
percent_chance = 101; /* Failure */
if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold"))
{
if (!(obj = get_obj_in_list_vis(victim, obj_name, victim->carrying)))
{
for (eq_pos = 0; (eq_pos < MAX_WEAR); eq_pos++)
if (victim->equipment[eq_pos] && (isname(obj_name, victim->equipment[eq_pos]->name)) &&
CAN_SEE_OBJ(ch, victim->equipment[eq_pos]))
{
obj = victim->equipment[eq_pos];
break;
}
if (!obj)
{
act("$E has not got that item.", FALSE, ch, 0, victim, TO_CHAR);
return TRUE;
}
else
{ /* It is equipment */
if ((GET_POS(victim) > POSITION_STUNNED))
{
cprintf(ch, "Steal the equipment now? Impossible!\r\n");
return TRUE;
}
else
{
act("You unequip $p and steal it.", FALSE, ch, obj, 0, TO_CHAR);
act("$n steals $p from $N.", FALSE, ch, obj, victim, TO_NOTVICT);
obj_to_char(unequip_char(victim, eq_pos), ch);
}
}
}
else
{ /* obj found in inventory */
percent_chance += GET_OBJ_WEIGHT(obj); /* Make heavy harder */
rp = real_roomp(ch->in_room);
if (IS_SET(rp->room_flags, NO_STEAL))
{
percent_chance = 101;
}
if (AWAKE(victim) && (percent_chance > ch->skills[SKILL_STEAL].learned))
{
ohoh = TRUE;
act("Oops..", FALSE, ch, 0, 0, TO_CHAR);
act("$n tried to steal something from you!", FALSE, ch, 0, victim, TO_VICT);
act("$n tries to steal something from $N.", TRUE, ch, 0, victim, TO_NOTVICT);
}
else
{ /* Steal the item */
if ((IS_CARRYING_N(ch) + 1 < CAN_CARRY_N(ch)))
{
if ((IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj)) < CAN_CARRY_W(ch))
{
obj_from_char(obj);
obj_to_char(obj, ch);
cprintf(ch, "Got it!\r\n");
if (ch->skills[SKILL_STEAL].learned < 50)
ch->skills[SKILL_STEAL].learned += 1;
}
}
else
cprintf(ch, "You cannot carry that much.\r\n");
}
}
}
else
{ /* Steal some coins */
if (AWAKE(victim) && (percent_chance > ch->skills[SKILL_STEAL].learned))
{
ohoh = TRUE;
act("Oops..", FALSE, ch, 0, 0, TO_CHAR);
act("You discover that $n has $s hands in your wallet.", FALSE, ch, 0, victim, TO_VICT);
act("$n tries to steal gold from $N.", TRUE, ch, 0, victim, TO_NOTVICT);
}
else
{
/*
* Steal some gold coins
*/
gold = (int)((GET_GOLD(victim) * number(1, 10)) / 100);
gold = MIN(100, gold);
if (gold > 0)
{
GET_GOLD(ch) += gold;
GET_GOLD(victim) -= gold;
cprintf(ch, "Bingo! You got %d gold coins.\r\n", gold);
}
else
{
cprintf(ch, "You couldn't get any gold...\r\n");
}
}
}
if (ohoh && IS_NPC(victim) && AWAKE(victim))
{
if (IS_SET(victim->specials.act, ACT_NICE_THIEF))
{
snprintf(buf, MAX_INPUT_LENGTH, "%s is a damn thief!", GET_NAME(ch));
do_shout(victim, buf, 0);
log_info("%s", buf);
cprintf(ch, "Don't you ever do that again!\r\n");
}
else
{
hit(victim, ch, TYPE_UNDEFINED);
}
}
return TRUE;
}
int do_practice(struct char_data *ch, const char *argument, int cmd)
{
char buf[MAX_STRING_LENGTH] = "\0\0\0\0\0\0\0";
int i = 0;
char first_arg[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
char sec_arg[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
int flag = FALSE;
/*
struct skill_struct {
char skill_name[40];
int skill_numb;
};
*/
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (cmd != CMD_practice)
return TRUE;
for (; isspace(*argument); argument++)
;
half_chop(argument, first_arg, sec_arg);
if (!*first_arg)
{
cprintf(ch, "You need to supply a class for that.");
return TRUE;
}
switch (*first_arg)
{
case 'w':
case 'W':
case 'f':
case 'F': {
if (!HasClass(ch, CLASS_WARRIOR))
{
cprintf(ch, "I bet you wish you were a warrior.\r\n");
return TRUE;
}
snprintf(buf, MAX_STRING_LENGTH, "You can practice any of these MANLY skills:\r\n");
for (i = 0; i < MAX_SKILLS; i++)
{
if (CanUseClass(ch, i, WARRIOR_LEVEL_IND))
scprintf(buf, MAX_STRING_LENGTH, "%s%s\r\n", spell_info[i].name, how_good(ch->skills[i].learned));
}
page_string(ch->desc, buf, 1);
return TRUE;
}
break;
case 'r':
case 'R': {
if (!HasClass(ch, CLASS_RANGER))
{
cprintf(ch, "I wish I was a Ranger too!\r\n");
return TRUE;
}
snprintf(buf, MAX_STRING_LENGTH, "You can practice any of these outdoor skills:\r\n");
for (i = 0; i < MAX_SKILLS; i++)
{
if (CanUseClass(ch, i, RANGER_LEVEL_IND))
scprintf(buf, MAX_STRING_LENGTH, "%s%s\r\n", spell_info[i].name, how_good(ch->skills[i].learned));
}
scprintf(buf, MAX_STRING_LENGTH, "Or these leaf-and-twig charms:\r\n");
for (i = 0; i < MAX_SKILLS; i++)
{
if (CanCastClass(ch, i, RANGER_LEVEL_IND))
scprintf(buf, MAX_STRING_LENGTH, "%s%s\r\n", spell_info[i].name, how_good(ch->skills[i].learned));
}
page_string(ch->desc, buf, 1);
return TRUE;
}
break;
case 't':
case 'T': {
if (!HasClass(ch, CLASS_THIEF))
{
cprintf(ch, "A voice whispers, 'You are not a thief.'\r\n");
return TRUE;
}
snprintf(buf, MAX_STRING_LENGTH, "You can practice any of these sneaky skills:\r\n");
for (i = 0; i < MAX_SKILLS; i++)
{
if (CanUseClass(ch, i, THIEF_LEVEL_IND))
scprintf(buf, MAX_STRING_LENGTH, "%s%s\r\n", spell_info[i].name, how_good(ch->skills[i].learned));
}
page_string(ch->desc, buf, 1);
return TRUE;
}
break;
case 'M':
case 'm': {
if (!HasClass(ch, CLASS_MAGIC_USER))
{
cprintf(ch, "You pretend to be a magic-user, 'Gooble-dah!'\r\n");
return TRUE;
}
flag = 0;
if (is_abbrev(sec_arg, "known"))
flag = 1;
snprintf(buf, MAX_STRING_LENGTH, "Your heavy spellbook contains these spells:\r\n");
for (i = 0; i < MAX_SKILLS; i++)
if (CanCastClass(ch, i, MAGE_LEVEL_IND))
{
if (!flag)
{
scprintf(buf, MAX_STRING_LENGTH, "[%2d] %s%s\r\n", spell_info[i].min_level[MAGE_LEVEL_IND],
spell_info[i].name, how_good(ch->skills[i].learned));
}
else
{
if (ch->skills[i].learned > 0)
{
scprintf(buf, MAX_STRING_LENGTH, "[%2d] %s%s\r\n", spell_info[i].min_level[MAGE_LEVEL_IND],
spell_info[i].name, how_good(ch->skills[i].learned));
}
}
}
page_string(ch->desc, buf, 1);
return TRUE;
}
break;
case 'C':
case 'c':
case 'P':
case 'p': {
if (!HasClass(ch, CLASS_CLERIC))
{
cprintf(ch, "You feel that impersonating a cleric might be bad.\r\n");
return TRUE;
}
snprintf(buf, MAX_STRING_LENGTH, "You can pray for any of these miracles:\r\n");
flag = 0;
if (is_abbrev(sec_arg, "known"))
flag = 1;
for (i = 0; i < MAX_SKILLS; i++)
if (CanCastClass(ch, i, CLERIC_LEVEL_IND))
{
if (!flag)
{
scprintf(buf, MAX_STRING_LENGTH, "[%2d] %s%s\r\n", spell_info[i].min_level[CLERIC_LEVEL_IND],
spell_info[i].name, how_good(ch->skills[i].learned));
}
else
{
if (ch->skills[i].learned > 0)
{
scprintf(buf, MAX_STRING_LENGTH, "[%2d] %s%s\r\n", spell_info[i].min_level[CLERIC_LEVEL_IND],
spell_info[i].name, how_good(ch->skills[i].learned));
}
}
}
page_string(ch->desc, buf, 1);
return TRUE;
}
break;
default:
cprintf(ch, "Ah, but practice which class???\r\n");
}
return TRUE;
}
int do_idea(struct char_data *ch, const char *argument, int cmd)
{
FILE *fl = NULL;
char str[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_NPC(ch))
{
cprintf(ch, "Monsters can't have ideas - Go away.\r\n");
return TRUE;
}
/*
* skip whites
*/
for (; isspace(*argument); argument++)
;
if (!*argument)
{
cprintf(ch, "That doesn't sound like a good idea to me.. Sorry.\r\n");
return TRUE;
}
if (!(fl = fopen(IDEA_FILE, "a")))
{
log_error("do_idea");
cprintf(ch, "Could not open the idea-file.\r\n");
return TRUE;
}
snprintf(str, MAX_INPUT_LENGTH, "**%s: %s\n", GET_NAME(ch), argument);
fputs(str, fl);
FCLOSE(fl);
cprintf(ch, "Woah! That's pretty cool. Thanks!\r\n");
return TRUE;
}
int do_typo(struct char_data *ch, const char *argument, int cmd)
{
FILE *fl = NULL;
char str[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_NPC(ch))
{
cprintf(ch, "Monsters can't spell - leave me alone.\r\n");
return TRUE;
}
/*
* skip whites
*/
for (; isspace(*argument); argument++)
;
if (!*argument)
{
cprintf(ch, "I beg your pardon?\r\n");
return TRUE;
}
if (!(fl = fopen(TYPO_FILE, "a")))
{
log_error("do_typo");
cprintf(ch, "Could not open the typo-file.\r\n");
return TRUE;
}
snprintf(str, MAX_INPUT_LENGTH, "**%s[%d]: %s\n", GET_NAME(ch), ch->in_room, argument);
fputs(str, fl);
FCLOSE(fl);
cprintf(ch, "No problem. We can send a whizzling to fix it.\r\n");
return TRUE;
}
int do_bug(struct char_data *ch, const char *argument, int cmd)
{
FILE *fl = NULL;
char str[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_NPC(ch))
{
cprintf(ch, "You are a monster! Bug off!\r\n");
return TRUE;
}
/*
* skip whites
*/
for (; isspace(*argument); argument++)
;
if (!*argument)
{
cprintf(ch, "Pardon?\r\n");
return TRUE;
}
if (!(fl = fopen(BUG_FILE, "a")))
{
log_error("do_bug");
cprintf(ch, "Could not open the bug-file.\r\n");
return TRUE;
}
snprintf(str, MAX_INPUT_LENGTH, "**%s[%d]: %s\n", GET_NAME(ch), ch->in_room, argument);
fputs(str, fl);
FCLOSE(fl);
cprintf(ch, "Really? Ok, we'll send someone to have a look.\r\n");
return TRUE;
}
int do_autoexit(struct char_data *ch, const char *argument, int cmd)
{
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_NPC(ch))
return TRUE;
if (IS_SET(ch->specials.new_act, NEW_PLR_AUTOEXIT))
{
cprintf(ch, "You will no longer see exits automatically.\r\n");
REMOVE_BIT(ch->specials.new_act, NEW_PLR_AUTOEXIT);
}
else
{
cprintf(ch, "You will now see exits automatically.\r\n");
SET_BIT(ch->specials.new_act, NEW_PLR_AUTOEXIT);
}
return TRUE;
}
int do_brief(struct char_data *ch, const char *argument, int cmd)
{
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_NPC(ch))
return TRUE;
if (IS_SET(ch->specials.act, PLR_BRIEF))
{
cprintf(ch, "Brief mode off.\r\n");
REMOVE_BIT(ch->specials.act, PLR_BRIEF);
}
else
{
cprintf(ch, "Brief mode on.\r\n");
SET_BIT(ch->specials.act, PLR_BRIEF);
}
return TRUE;
}
int do_compact(struct char_data *ch, const char *argument, int cmd)
{
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
if (IS_NPC(ch))
return TRUE;
if (IS_SET(ch->specials.act, PLR_COMPACT))
{
cprintf(ch, "You are now in the uncompacted mode.\r\n");
REMOVE_BIT(ch->specials.act, PLR_COMPACT);
}
else
{
cprintf(ch, "You are now in compact mode.\r\n");
SET_BIT(ch->specials.act, PLR_COMPACT);
}
return TRUE;
}
int do_group(struct char_data *ch, const char *argument, int cmd)
{
char name[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
struct char_data *victim = NULL;
struct char_data *k = NULL;
struct follow_type *f = NULL;
int found = FALSE;
int victlvl = 0;
int chlvl = 0;
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
only_argument(argument, name);
if (!*name)
{
if (!IS_AFFECTED(ch, AFF_GROUP))
{
cprintf(ch, "But you are a member of no group?!\r\n");
}
else
{
cprintf(ch, "Your group consists of:\r\n");
if (ch->master)
k = ch->master;
else
k = ch;
if (IS_AFFECTED(k, AFF_GROUP))
act(" $N (Head of group)", FALSE, ch, 0, k, TO_CHAR);
for (f = k->followers; f; f = f->next)
if (IS_AFFECTED(f->follower, AFF_GROUP))
act(" $N", FALSE, ch, 0, f->follower, TO_CHAR);
}
return TRUE;
}
if (!(victim = get_char_room_vis(ch, name)))
{
cprintf(ch, "No one here by that name.\r\n");
}
else
{
if (ch->master)
{
act("You can not enroll group members without being head of a group.", FALSE, ch, 0, 0, TO_CHAR);
return TRUE;
}
found = FALSE;
if (victim == ch)
found = TRUE;
else
{
for (f = ch->followers; f; f = f->next)
{
if (f->follower == victim)
{
found = TRUE;
break;
}
}
}
if (found)
{
if (IS_AFFECTED(victim, AFF_GROUP))
{
if (victim != ch)
{
act("$n has been kicked out of $N's group!", FALSE, victim, 0, ch, TO_ROOM);
act("You are no longer a member of $N's group!", FALSE, victim, 0, ch, TO_CHAR);
}
else
{
act("You are no longer a group leader!", FALSE, victim, 0, ch, TO_CHAR);
}
REMOVE_BIT(victim->specials.affected_by, AFF_GROUP);
}
else
{
if (IS_IMMORTAL(victim) && !IS_IMMORTAL(ch))
{
act("You really don't want $n in your group.", FALSE, victim, 0, 0, TO_CHAR);
return TRUE;
}
/*
* if ((chlvl= GetMaxLevel(ch)) >= LOW_IMMORTAL) {
* act("Now now. That would be CHEATING!", FALSE, ch, 0, 0, TO_CHAR);
* return TRUE;
* }
*/
chlvl = GetMaxLevel(ch);
victlvl = GetMaxLevel(victim);
if (IS_PC(victim) && victim != ch)
{
int toolow, toohigh;
/*
* newbies can mix with each other
*/
toolow = (chlvl <= 4) ? 0 : MAX(3, chlvl / 2);
/*
* but newbies and adults don't mix
*/
toohigh = (chlvl <= 4) ? 5 : (chlvl + chlvl / 2);
if (victlvl <= toolow)
{
act("It would be beneath you to lead the lowly $N into battle!", FALSE, ch, 0, victim, TO_CHAR);
act("$N is too mighty to pay any heed to the likes of you!", FALSE, victim, 0, ch, TO_CHAR);
act("$N tells $n to bugger off.", FALSE, victim, 0, ch, TO_ROOM);
return TRUE;
}
if (victlvl >= toohigh)
{
act("You WISH $N would deign to join your group!", FALSE, ch, 0, victim, TO_CHAR);
act("$N BEGS you to help $M go kill the chickens.", FALSE, victim, 0, ch, TO_CHAR);
act("$N grovels and begs $n to join $S group.", FALSE, victim, 0, ch, TO_ROOM);
return TRUE;
}
}
if (victim != ch)
{
act("$n joins the glorious cause of $N's group.", FALSE, victim, 0, ch, TO_ROOM);
act("You are now a member of $N's group.", FALSE, victim, 0, ch, TO_CHAR);
}
else
{
act("You are now your own group leader.", FALSE, victim, 0, ch, TO_CHAR);
}
SET_BIT(victim->specials.affected_by, AFF_GROUP);
}
}
else
{
act("$N must follow you, to enter the group", FALSE, ch, 0, victim, TO_CHAR);
}
}
return TRUE;
}
int do_quaff(struct char_data *ch, const char *argument, int cmd)
{
char buf[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0";
struct obj_data *temp = NULL;
int i = 0;
int equipped = FALSE;
if (DEBUG)
log_info("called %s with %s, %s, %d", __PRETTY_FUNCTION__, SAFE_NAME(ch), VNULL(argument), cmd);
only_argument(argument, buf);
if (!(temp = get_obj_in_list_vis(ch, buf, ch->carrying)))
{
temp = ch->equipment[HOLD];
equipped = TRUE;
if ((temp == 0) || !isname(buf, temp->name))
{
act("You do not have that item.", FALSE, ch, 0, 0, TO_CHAR);
return TRUE;
}
}
if (!IS_IMMORTAL(ch))
{
if (GET_COND(ch, FULL) > 20)
{
act("Your stomach can't contain anymore!", FALSE, ch, 0, 0, TO_CHAR);
return TRUE;
}
else
{
GET_COND(ch, FULL) += 1;
}
}
if (temp->obj_flags.type_flag != ITEM_POTION)
{
act("You can only quaff potions.", FALSE, ch, 0, 0, TO_CHAR);
return TRUE;
}
act("$n quaffs $p.", TRUE, ch, temp, 0, TO_ROOM);
act("You quaff $p which dissolves.", FALSE, ch, temp, 0, TO_CHAR);
/*
* my stuff
*/
if (ch->specials.fighting)
{
if (equipped)
{
if (number(1, 20) > ch->abilities.dex)
{
act("$n is jolted and drops $p! It shatters!", TRUE, ch, temp, 0, TO_ROOM);
act("You arm is jolted and $p flies from your hand, *SMASH*", TRUE, ch, temp, 0, TO_CHAR);
if (equipped)
temp = unequip_char(ch, HOLD);
extract_obj(temp);
return TRUE;
}
}