-
Notifications
You must be signed in to change notification settings - Fork 23
/
act.other.c
executable file
·9617 lines (8582 loc) · 305 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 Part of LuminariMUD *
* Usage: Miscellaneous player-level commands. *
* *
* 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. *
**************************************************************************/
/* needed by sysdep.h to allow for definition of <sys/stat.h> */
#define __ACT_OTHER_C__
#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 "house.h"
#include "constants.h"
#include "dg_scripts.h"
#include "act.h"
#include "spec_procs.h"
#include "class.h"
#include "fight.h"
#include "mail.h" /* for has_mail() */
#include "shop.h"
#include "quest.h"
#include "modify.h"
#include "race.h"
#include "clan.h"
#include "mud_event.h"
#include "craft.h"
#include "treasure.h"
#include "mudlim.h"
#include "spec_abilities.h"
#include "actions.h"
#include "feats.h"
#include "assign_wpn_armor.h"
#include "item.h"
#include "oasis.h"
#include "domains_schools.h"
#include "spells.h"
#include "spell_prep.h"
#include "premadebuilds.h"
#include "staff_events.h"
#include "account.h"
#include "deities.h"
#include "evolutions.h"
/* some defines for gain/respec */
#define MODE_CLASSLIST_NORMAL 0
#define MODE_CLASSLIST_RESPEC 1
#if defined(CAMPAIGN_DL)
#define MULTICAP 5
#else
#define MULTICAP 3
#endif
#define WILDSHAPE_AFFECTS 4
#define TOG_OFF 0
#define TOG_ON 1
/* debugging */
#define DEBUG_MODE FALSE
/* Local defined utility functions */
/* do_group utility functions */
static void print_group(struct char_data *ch);
static void display_group_list(struct char_data *ch);
// external functions
void save_char_pets(struct char_data *ch);
/*****************/
/* exchange code */
#define EXP_EXCHANGE_RATE 0.00001 /* how much doex exp cost (purchase currency = qp) */
#define ACCEXP_EXCHANGE_RATE 8000.0 /* how much does accexp cost (purchase currency = xp) */
#define GOLD_EXCHANGE_RATE 10.0 /* how much does gold cost (purchase currency = account xp) */
#define QP_EXCHANGE_RATE 300.0 /* how much does qp cost (purchase currency = gold) */
#define SRC_DST_ACCEXP 1
#define SRC_DST_QP 2
#define SRC_DST_GOLD 3
#define SRC_DST_EXP 4
#define NUM_EXCHANGE_TYPES 5 // one more than the last above
const char *exchange_types[NUM_EXCHANGE_TYPES] =
{
"",
"account experience",
"quest points",
"gold coins",
"experience"};
#if 0
/* previous version */
void show_exchange_rates(struct char_data *ch)
{
send_to_char(ch, "Usage: exchange <currency source> <currency purchasing> <amount to purchase>\r\n");
send_to_char(ch, " This command is used to exchange in-game currencies including your "
"experience points, gold coins, account experience or quest points.\r\n");
send_to_char(ch, " currencies: accexp | qp | gold | exp\r\n");
send_to_char(ch, " current exchange rates: accexp: %d, qp: %d, gold: %d, exp: %d",
(int)ACCEXP_EXCHANGE_RATE,
(int)QP_EXCHANGE_RATE,
(int)GOLD_EXCHANGE_RATE,
(int)EXP_EXCHANGE_RATE);
return;
}
#endif
void show_exchange_rates(struct char_data *ch)
{
send_to_char(ch, "Usage: cexchange <currency source> <amount to purchase of exchange currency>\r\n");
send_to_char(ch, "This command is used to exchange in-game currencies including your "
"experience points, gold coins, account experience or quest points.\r\n");
send_to_char(ch, "The exchange order is: exp -> accexp -> gold -> qp -> (back to start) exp -> ...\r\n");
send_to_char(ch, " currencies: exp | accexp | gold | qp \r\n");
send_to_char(ch, " current exchange rates (cost in source currency): xp->accexp: %lf, accexp->gold: %lf, gold->qp: %lf, qp->exp: %lf\r\n",
ACCEXP_EXCHANGE_RATE,
GOLD_EXCHANGE_RATE,
QP_EXCHANGE_RATE,
EXP_EXCHANGE_RATE);
return;
}
/* currency exchange code, second version, only direct exchange in currency to designated currency */
ACMD(do_cexchange)
{
char arg1[MAX_STRING_LENGTH] = {'\0'};
char arg2[MAX_STRING_LENGTH] = {'\0'};
float amount = 0.0, cost = 0.0;
int source = 0, xp_excess = 0, xp_profit = 0;
/*debug*/
if (DEBUG_MODE)
{
if (GET_LEVEL(ch) < LVL_STAFF)
{
send_to_char(ch, "Under construction!\r\n");
return;
}
}
/* end debug */
two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
if (!*arg1 || !*arg2)
{
show_exchange_rates(ch);
return;
}
/* valid arguments */
if (!is_number(arg2))
{
show_exchange_rates(ch);
send_to_char(ch, "The second argument is invalid, it needs to be a number.\r\n");
return;
}
amount = atoi(arg2);
if (amount <= 0.0)
{
show_exchange_rates(ch);
send_to_char(ch, "The second argument needs to be above 0.\r\n");
return;
}
if (is_abbrev(arg1, "accexp"))
{
source = SRC_DST_ACCEXP;
}
else if (is_abbrev(arg1, "qp"))
{
source = SRC_DST_QP;
}
else if (is_abbrev(arg1, "gold"))
{
source = SRC_DST_GOLD;
}
else if (is_abbrev(arg1, "exp"))
{
source = SRC_DST_EXP;
}
else
{
show_exchange_rates(ch);
send_to_char(ch, "The first argument is invalid or missing.\r\n");
return;
}
/* everything should be valid by now, so time for some math */
switch (source)
{
case SRC_DST_EXP:
/* amount limitation */
if (amount >= 99999)
{
send_to_char(ch, "The second argument (amount) needs to be below 99999.\r\n");
return;
}
/* how much is this transaction going to "cost" */
cost = ACCEXP_EXCHANGE_RATE * amount;
/* cap for account xp currently */
if ((amount + (float)GET_ACCEXP_DESC(ch)) > 99999999.9)
{
send_to_char(ch, "Account experience caps at 100mil.\r\n");
return;
}
/* xp has to be overflow! */
xp_excess = (GET_EXP(ch) - level_exp(ch, (LVL_IMMORT - 1)));
/* can we afford it? if so, go ahead and make exchange */
if (xp_excess < cost)
{
send_to_char(ch, "You do not have enough experience points, you need an xp-excess of %d (you have %d).\r\n",
(int)cost, xp_excess);
return;
}
/* bingo! */
GET_EXP(ch) -= (int)cost; /* loss*/
change_account_xp(ch, (int)amount); /* gain */
send_to_char(ch, "You exchange %d experience points for %d accexp\r\n", (int)cost, (int)amount);
break;
case SRC_DST_ACCEXP:
/* amount limitation */
if (amount >= 99999)
{
send_to_char(ch, "The second argument (amount) needs to be below 99999.\r\n");
return;
}
/* how much is this transaction going to "cost" */
cost = GOLD_EXCHANGE_RATE * amount;
/* can we afford it? if so, go ahead and make exchange */
if ((float)GET_ACCEXP_DESC(ch) < cost)
{
send_to_char(ch, "You do not have enough account exp, you need %d total (you have %d).\r\n",
(int)cost, GET_ACCEXP_DESC(ch));
return;
}
/* bingo! */
change_account_xp(ch, -(int)cost); /* loss */
increase_gold(ch, (int)amount); /* gain */
send_to_char(ch, "You exchange %d account exp for %d gold\r\n", (int)cost, (int)amount);
break;
case SRC_DST_GOLD:
/* amount limitation */
if (amount >= 99999)
{
send_to_char(ch, "The second argument (amount) needs to be below 99999.\r\n");
return;
}
/* how much is this transaction going to "cost" */
cost = QP_EXCHANGE_RATE * amount;
/* can we afford it? if so, go ahead and make exchange */
if ((float)GET_GOLD(ch) < cost)
{
send_to_char(ch, "You do not have enough gold on hand, you need %d total on "
"hand (not in bank) to make the exchange (you have %d).\r\n",
(int)cost, GET_GOLD(ch));
return;
}
/* bingo! */
increase_gold(ch, -(int)cost);
GET_QUESTPOINTS(ch) += (int)amount;
send_to_char(ch, "You exchange %d gold for %d qp\r\n", (int)cost, (int)amount);
break;
case SRC_DST_QP:
if (GET_LEVEL(ch) < (LVL_IMMORT - 1))
{
send_to_char(ch, "This exchange is reserved for level 30 chars!\r\n");
return;
}
/* amount limitation */
if (amount >= 1000000000)
{
send_to_char(ch, "The second argument (amount) needs to be below 1 bil.\r\n");
return;
}
/* this is the inverse of our exchange rate */
xp_profit = ((int)(1.0 / EXP_EXCHANGE_RATE) + 1);
/* there is a "profit" in this exchange */
if ((int)amount % xp_profit)
{
send_to_char(ch, "To exchange qp to exp, you need to pick increments of %d.\r\n", xp_profit);
return;
}
/* how much is this transaction going to "cost" */
cost = EXP_EXCHANGE_RATE * amount;
/* just in case of a math error? */
if (cost < 1.0)
{
send_to_char(ch, "ERR: Report to Staff (cexchange001)\r\n");
return;
}
/* can we afford it? if so, go ahead and make exchange */
if ((float)GET_QUESTPOINTS(ch) < cost)
{
send_to_char(ch, "You do not have enough quest points, you need %d total (you have %d).\r\n",
(int)cost, GET_QUESTPOINTS(ch));
return;
}
/* bingo! */
GET_QUESTPOINTS(ch) -= (int)cost;
GET_EXP(ch) += (int)amount;
send_to_char(ch, "You exchange %d quest points for %d exp\r\n", (int)cost, (int)amount);
break;
default: /* should never get here */
show_exchange_rates(ch);
send_to_char(ch, "Please report to staff: reached default case in exchange switch in do_cexchange.\r\n");
return;
}
/* debugging */
if (DEBUG_MODE)
{
send_to_char(ch, "cexchange() debug 1: source: %d, amount: %lf, cost: %lf.\r\n", source, amount, cost);
}
/* done! */
return;
}
#if 0
/* currency exchange code, first version, unfinished */
ACMD(do_cexchange)
{
char arg1[MAX_STRING_LENGTH] = {'\0'};
char arg2[MAX_STRING_LENGTH] = {'\0'};
char arg3[MAX_STRING_LENGTH] = {'\0'};
float amount = 0.0, cost = 0.0, pool = 0.0;
int source = 0, exchange = 0;
/*temp*/
if (GET_LEVEL(ch) < LVL_STAFF)
{
send_to_char(ch, "Under construction!\r\n");
return;
}
/*TEMP*/
three_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2), arg3, sizeof(arg3));
if (!*arg1 || !*arg2 || !*arg3)
{
send_to_char(ch, "You need to provide more information.\r\n");
show_exchange_rates(ch);
return;
}
/* valid arguments */
if (!is_number(arg3))
{
send_to_char(ch, "The third argument is invalid, it needs to be a number.\r\n");
show_exchange_rates(ch);
return;
}
amount = atoi(arg3);
if (amount <= 0)
{
send_to_char(ch, "The third argument needs to be above 0.\r\n");
show_exchange_rates(ch);
return;
}
if (is_abbrev(arg1, "accexp"))
source = SRC_DST_ACCEXP;
else if (is_abbrev(arg1, "qp"))
source = SRC_DST_QP;
else if (is_abbrev(arg1, "gold"))
source = SRC_DST_GOLD;
else if (is_abbrev(arg1, "exp"))
source = SRC_DST_EXP;
else
{
send_to_char(ch, "The first argument is invalid.\r\n");
show_exchange_rates(ch);
return;
}
if (is_abbrev(arg2, "accexp"))
exchange = SRC_DST_ACCEXP;
else if (is_abbrev(arg2, "qp"))
exchange = SRC_DST_QP;
else if (is_abbrev(arg2, "gold"))
exchange = SRC_DST_GOLD;
else if (is_abbrev(arg2, "exp"))
exchange = SRC_DST_EXP;
else
{
send_to_char(ch, "The second argument is invalid.\r\n");
show_exchange_rates(ch);
return;
}
if (source == exchange)
{
send_to_char(ch, "Your source and desired currency types cannot be the same.\r\n");
show_exchange_rates(ch);
return;
}
/* everything should be valid by now, so time for some math */
/* how much is this transaction going to "cost" */
switch (exchange)
{
case SRC_DST_ACCEXP:
cost = (float)ACCEXP_EXCHANGE_RATE * amount;
/* cap for account xp currently */
if ((amount + (float)GET_ACCEXP_DESC(ch)) > 99999999.9)
{
send_to_char(ch, "Account experience caps at 100mil.\r\n");
return;
}
break;
case SRC_DST_QP:
cost = (float)QP_EXCHANGE_RATE * amount;
break;
case SRC_DST_GOLD:
cost = (float)GOLD_EXCHANGE_RATE * amount;
break;
case SRC_DST_EXP:
cost = (float)EXP_EXCHANGE_RATE * amount;
break;
default: /* should never get here */
show_exchange_rates(ch);
send_to_char(ch, "Please report to staff: reached default case in 1st exchange switch in do_cexchange.\r\n");
return;
}
/* can we afford it? if so, go ahead and charge 'em */
switch (source)
{
case SRC_DST_ACCEXP:
pool = cost / ((float)ACCEXP_EXCHANGE_RATE); /* amount we need */
if (pool < 1.0)
{
send_to_char(ch, "You need to increase the amount for this exchange.\r\n");
return;
}
if (GET_ACCEXP_DESC(ch) < pool)
{
send_to_char(ch, "You do not have enough account exp, you need %d total.\r\n", (int)pool);
return;
}
/* bingo! */
change_account_xp(ch, -pool);
save_account(ch->desc->account);
send_to_char(ch, "You exchange %d account exp for ", (int)pool);
break;
case SRC_DST_QP:
pool = cost / ((float)QP_EXCHANGE_RATE); /* amount we need */
if (pool < 1.0)
{
send_to_char(ch, "You need to increase the amount for this exchange.\r\n");
return;
}
if (GET_QUESTPOINTS(ch) < pool)
{
send_to_char(ch, "You do not have enough quest points, you need %d total.\r\n", (int)pool);
return;
}
/* bingo! */
GET_QUESTPOINTS(ch) -= pool;
send_to_char(ch, "You exchange %d quest points for ", (int)pool);
break;
case SRC_DST_GOLD:
pool = cost / ((float)GOLD_EXCHANGE_RATE); /* amount we need */
if (pool < 1.0)
{
send_to_char(ch, "You need to increase the amount for this exchange.\r\n");
return;
}
if (GET_GOLD(ch) < pool)
{
send_to_char(ch, "You do not have enough gold on hand, you need %d total on "
"hand (not in bank) to make the exchange.\r\n",
(int)pool);
return;
}
/* bingo! */
GET_GOLD(ch) -= pool;
send_to_char(ch, "You exchange %d gold for ", (int)pool);
break;
case SRC_DST_EXP:
pool = cost / ((float)EXP_EXCHANGE_RATE); /* amount we need */
if (pool <= 0.0)
{
send_to_char(ch, "You need to increase the amount for this exchange.\r\n");
return;
}
if (GET_EXP(ch) < pool)
{
send_to_char(ch, "You do not have enough experience points, you need %d total.\r\n", (int)pool);
return;
}
/* bingo! */
GET_EXP(ch) -= pool;
send_to_char(ch, "You exchange %d experience points for ", (int)pool);
break;
default: /*shouldn't get here*/
show_exchange_rates(ch);
send_to_char(ch, "Please report to staff: reached default case in source switch in do_exchange.\r\n");
return;
}
/* final portion of transaction, give them their purchase */
switch (exchange)
{
case SRC_DST_ACCEXP:
send_to_char(ch, "%d account experience.", (int)amount);
change_account_xp(ch, (int)amount);
break;
case SRC_DST_QP:
send_to_char(ch, "%d quest points.", (int)amount);
GET_QUESTPOINTS(ch) += (int)amount;
break;
case SRC_DST_GOLD:
send_to_char(ch, "%d gold coins.", (int)amount);
GET_GOLD(ch) += (int)amount;
break;
case SRC_DST_EXP:
send_to_char(ch, "%d experience points.", (int)amount);
GET_EXP(ch) += (int)amount;
break;
default: /* should never get here */
show_exchange_rates(ch);
send_to_char(ch, "Please report to staff: reached default case in 2nd exchange switch in do_cexchange.\r\n");
return;
}
return;
}
#endif
#undef ACCEXP_EXCHANGE_RATE
#undef QP_EXCHANGE_RATE
#undef GOLD_EXCHANGE_RATE
#undef EXP_EXCHANGE_RATE
#undef SRC_DST_ACCEXP
#undef SRC_DST_QP
#undef SRC_DST_GOLD
#undef SRC_DST_EXP
/*end exchange code */
ACMD(do_nop)
{
send_to_char(ch, "\r\n");
}
ACMDU(do_handleanimal)
{
struct char_data *vict = NULL;
int dc = 0;
if (!GET_ABILITY(ch, ABILITY_HANDLE_ANIMAL))
{
send_to_char(ch, "You have no idea how to do that!\r\n");
return;
}
skip_spaces(&argument);
if (!*argument)
{
send_to_char(ch, "You need a target to attempt this.\r\n");
return;
}
else
{
/* there is an argument, lets make sure it is valid */
if (!(vict = get_char_vis(ch, argument, NULL, FIND_CHAR_ROOM)))
{
send_to_char(ch, "Whom do you wish to shift?\r\n");
return;
}
}
if (vict == ch)
{
send_to_char(ch, "You are trying to animal-handle yourself?\r\n");
return;
}
if (!IS_ANIMAL(vict))
{
send_to_char(ch, "You can only 'handle animals' that are actually animals.\r\n");
return;
}
/* you have to be higher level to have a chance */
if (GET_LEVEL(vict) >= GET_LEVEL(ch))
{
dc += 999; /* impossible */
}
USE_STANDARD_ACTION(ch);
/* skill check */
/* dc = hit-dice + 20 */
dc = GET_LEVEL(vict) + 20;
if (!skill_check(ch, ABILITY_HANDLE_ANIMAL, dc))
{
/* failed, do another check to see if you pissed off the animal */
if (!skill_check(ch, ABILITY_HANDLE_ANIMAL, dc))
{
send_to_char(ch, "You failed to properly train the animal to follow your "
"commands, and the animal now seems aggressive.\r\n");
hit(vict, ch, TYPE_UNDEFINED, DAM_RESERVED_DBC, 0, FALSE);
return;
}
/* escaped unscathed :P */
send_to_char(ch, "You failed to properly train the animal to follow your commands.\r\n");
return;
}
/* success! but they now get a saving throw */
effect_charm(ch, vict, SPELL_CHARM_ANIMAL, CAST_INNATE, GET_LEVEL(ch));
return;
}
/* innate animate dead ability */
ACMD(do_animatedead)
{
int uses_remaining = 0;
struct char_data *mob = NULL;
mob_vnum mob_num = 0;
if (!HAS_FEAT(ch, FEAT_ANIMATE_DEAD))
{
send_to_char(ch, "You do not know how to animate dead!\r\n");
return;
}
if (IS_HOLY(IN_ROOM(ch)))
{
send_to_char(ch, "This place is too holy for such blasphemy!");
return;
}
// if (check_npc_followers(ch, NPC_MODE_FLAG, MOB_ANIMATED_DEAD))
if (!can_add_follower_by_flag(ch, MOB_ANIMATED_DEAD))
{
send_to_char(ch, "You can't control more undead!\r\n");
return;
}
if (AFF_FLAGGED(ch, AFF_CHARM))
{
send_to_char(ch, "You are too giddy to have any followers!\r\n");
return;
}
if ((uses_remaining = daily_uses_remaining(ch, FEAT_ANIMATE_DEAD)) == 0)
{
send_to_char(ch, "You must recover the energy required to animate the dead.\r\n");
return;
}
if (uses_remaining < 0)
{
send_to_char(ch, "You are not experienced enough.\r\n");
return;
}
/* success! */
if (CASTER_LEVEL(ch) >= 30)
mob_num = MOB_MUMMY;
else if (CASTER_LEVEL(ch) >= 20)
mob_num = MOB_GIANT_SKELETON;
else if (CASTER_LEVEL(ch) >= 10)
mob_num = MOB_GHOUL;
else
mob_num = MOB_ZOMBIE;
if (!(mob = read_mobile(mob_num, VIRTUAL)))
{
send_to_char(ch, "You don't quite remember how to make that creature.\r\n");
return;
}
if (ZONE_FLAGGED(GET_ROOM_ZONE(IN_ROOM(ch)), ZONE_WILDERNESS))
{
X_LOC(mob) = world[IN_ROOM(ch)].coords[0];
Y_LOC(mob) = world[IN_ROOM(ch)].coords[1];
}
char_to_room(mob, IN_ROOM(ch));
IS_CARRYING_W(mob) = 0;
IS_CARRYING_N(mob) = 0;
SET_BIT_AR(AFF_FLAGS(mob), AFF_CHARM);
act("$n animates a corpse!", FALSE, ch, 0, mob, TO_ROOM);
act("You animate a corpse!", FALSE, ch, 0, mob, TO_CHAR);
load_mtrigger(mob);
add_follower(mob, ch);
if (!GROUP(mob) && GROUP(ch) && GROUP_LEADER(GROUP(ch)) == ch)
join_group(mob, GROUP(ch));
if (!IS_NPC(ch))
start_daily_use_cooldown(ch, FEAT_ANIMATE_DEAD);
USE_STANDARD_ACTION(ch);
}
ACMD(do_abundantstep)
{
int steps = 0, i = 0, j, repeat = 0, max = 0;
room_rnum room_tracker = NOWHERE, nextroom = NOWHERE;
char buf[MAX_INPUT_LENGTH] = {'\0'}, tc = '\0';
const char *p = NULL;
if (!HAS_FEAT(ch, FEAT_ABUNDANT_STEP))
{
send_to_char(ch, "You do not know that martial art skill!\r\n");
return;
}
if (FIGHTING(ch))
{
send_to_char(ch, "You can't focus enough in combat to use this martial art skill!\r\n");
return;
}
if (GET_MOVE(ch) < 300)
{
send_to_char(ch, "You are too tired to use this martial art skill!\r\n");
return;
}
/* 3.23.18 Ornir, bugfix. */
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_NOTELEPORT))
{
send_to_char(ch, "You are unable to shift to the ethereal plane in this place!\r\n");
return;
}
steps = 0;
room_tracker = IN_ROOM(ch); /* start the room tracker in current location */
p = argument;
max = 5 + CLASS_LEVEL(ch, CLASS_MONK) / 2; /* maximum steps */
while (p && *p && !isdigit(*p) && !isalpha(*p))
p++; /* looking for first number or letter */
if (!p || !*p)
{ /* empty argument */
send_to_char(ch, "You must give directions from your current location. Examples:\r\n"
" w w n n e\r\n"
" 2w n n e\r\n");
return;
}
/* step through our string */
while (*p)
{
while (*p && !isdigit(*p) && !isalpha(*p))
p++; /* skipping spaces, and anything not a letter or number */
if (isdigit(*p))
{ /* value a number? if so it will be our repeat */
repeat = atoi(p);
while (isdigit(*p)) /* get rid of extra numbers */
p++;
}
else /* value isn't a number, so we are moving just a single space */
repeat = 1;
/* indication we haven't found a direction to move yet */
i = -1;
if (isalpha(*p))
{ /* ok found a letter, and repeat is set */
for (i = 0; isalpha(*p); i++, p++)
buf[i] = LOWER(*p); /* turn a string of letters into lower case buf */
j = i; /* how many letters we found */
tc = buf[i]; /* the non-alpha that terminated us */
buf[i] = 0; /* placing a '0' in that last spot in this mini buf */
for (i = 1; complete_cmd_info[i].command_pointer == do_move && strcmp(complete_cmd_info[i].sort_as, buf); i++)
; /* looking for a move command that matches our buf */
if (complete_cmd_info[i].command_pointer == do_move)
{
i = complete_cmd_info[i].subcmd;
}
else
i = -1;
/* so now i is either our direction to move (define) or -1 */
buf[j] = tc; /* replace the terminating character in this mini buff */
// send_to_char(ch, "i: %d\r\n", i);
}
if (i > -1)
{ /* we have a direction to move! */
while (repeat > 0)
{
repeat--;
if (++steps > max) /* reached our limit of steps! */
break;
if (!W_EXIT(room_tracker, i))
{ /* is i a valid direction? */
send_to_char(ch, "Invalid step. Skipping.\r\n");
break;
}
nextroom = W_EXIT(room_tracker, i)->to_room;
if (nextroom == NOWHERE)
break;
/* 3.23.18 Ornir, bugfix. */
if (ROOM_FLAGGED(nextroom, ROOM_NOTELEPORT) || ROOM_FLAGGED(nextroom, ROOM_HOUSE))
{
send_to_char(ch, "You can not access your destination through the ethereal plane! At least part of the path is obstructed...\r\n");
return;
}
room_tracker = nextroom;
}
}
if (steps > max)
break;
} /* finished stepping through the string */
if (IN_ROOM(ch) != room_tracker)
{
send_to_char(ch, "Your will bends reality as you travel through the ethereal plane.\r\n");
act("$n is suddenly absent.", TRUE, ch, 0, 0, TO_ROOM);
char_from_room(ch);
if (ZONE_FLAGGED(GET_ROOM_ZONE(room_tracker), ZONE_WILDERNESS))
{
X_LOC(ch) = world[room_tracker].coords[0];
Y_LOC(ch) = world[room_tracker].coords[1];
}
char_to_room(ch, room_tracker);
act("$n is suddenly present.", TRUE, ch, 0, 0, TO_ROOM);
look_at_room(ch, 0);
GET_MOVE(ch) -= 300;
USE_MOVE_ACTION(ch);
}
else
{
send_to_char(ch, "You failed!\r\n");
}
return;
}
/* ethereal shift - monk epic feat skill/cleric travel domain power/feat, allows
* shifting of self and group members to the ethereal plane and back */
ACMDU(do_ethshift)
{
#if defined(CAMPAIGN_DL) || defined(CAMPAIGN_FR)
send_to_char(ch, "This power is disabled as there is no planar travel on this game. This ability will be recoded to reflect that soon.\r\n");
return;
#endif
struct char_data *shiftee = NULL;
room_rnum shift_dest = NOWHERE;
// int counter = 0;
skip_spaces(&argument);
if (!HAS_FEAT(ch, FEAT_OUTSIDER) && !HAS_FEAT(ch, FEAT_ETH_SHIFT))
{
send_to_char(ch, "You do not know how!\r\n");
return;
}
if (!*argument)
{
shiftee = ch;
}
else
{
/* there is an argument, lets make sure it is valid */
if (!(shiftee = get_char_vis(ch, argument, NULL, FIND_CHAR_ROOM)))
{
send_to_char(ch, "Whom do you wish to shift?\r\n");
return;
}
/* ok we have a target, is this target grouped? */
if (!GROUP(ch) || (GROUP(shiftee) != GROUP(ch)))
{
send_to_char(ch, "You can only shift someone else if they are in the same "
"group as you.\r\n");
return;
}
}
/* ok make sure it is ok to teleport */
if (!valid_mortal_tele_dest(shiftee, IN_ROOM(ch), FALSE))
{
send_to_char(ch, "Something in this area is stopping your power!\r\n");
return;
}
/* check if shiftee is already on eth */
if (ZONE_FLAGGED(GET_ROOM_ZONE(IN_ROOM(ch)), ZONE_ETH_PLANE))
{
send_to_char(ch, "Attempting to shift to the prime plane...\r\n");
do
{
shift_dest = rand_number(0, top_of_world);
// counter++;
// send_to_char(ch, "%d | %d, ", counter, shift_dest);
} while ((ZONE_FLAGGED(GET_ROOM_ZONE(shift_dest), ZONE_ELEMENTAL) ||
ZONE_FLAGGED(GET_ROOM_ZONE(shift_dest), ZONE_ETH_PLANE) ||
ZONE_FLAGGED(GET_ROOM_ZONE(shift_dest), ZONE_ASTRAL_PLANE)));
/* check if shiftee is on prime */
}