-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathimm.cc
More file actions
2709 lines (2153 loc) · 64.6 KB
/
imm.cc
File metadata and controls
2709 lines (2153 loc) · 64.6 KB
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
#include <ctype.h>
#include <dirent.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <unistd.h>
#include "define.h"
#include "struct.h"
const char *imm_title [] = { "Avatar", "Apprentice", "Builder", "Designer", "Architect", "Spirit", "Angel", "Demigod", "God" };
const char *permission_name [ MAX_PERMISSION ] = {
"all_mobs", "all_objects", "all_rooms", "approve", "basic", "build_chan", "commands", "echo", "god_chan",
"goto", "help_files", "imm_chan", "lists", "load_objects", "misc_tables", "mobs", "noteboard",
"objects", "players", "quests", "reimb_exp", "reimb_equip", "rooms", "shutdown", "accounts",
"snoop", "spells", "socials", "transfer", "unfinished", "write_all", "write_areas",
"avatar_chan", "clans", "rtables", "disabled", "force_players", "admin_chan" };
/*
* PERMISSION ROUTINES
*/
int invis_level( const char_data *ch )
{
const wizard_data *imm = wizard( ch );
if( !imm
|| imm->species
|| imm->pcdata->pfile->trust < LEVEL_APPRENTICE
|| !is_set( imm->pcdata->pfile->flags, PLR_WIZINVIS ) )
return 0;
return imm->wizinvis;
}
bool has_holylight( const char_data *ch )
{
// if( !wizard( ch ) )
if( !ch || !ch->pcdata )
return false;
return is_set( ch->pcdata->pfile->flags, PLR_HOLYLIGHT );
}
bool mortal( char_data* ch, char* command )
{
if( !ch->species && ch->Level() >= LEVEL_APPRENTICE )
return false;
fsend( ch,
"To prevent abuse you are unable to use %s in mortal form.\n\r",
command );
return true;
}
bool has_permission( const char_data* ch, int* flag, bool msg )
{
if( flag[0] == 0 && flag[1] == 0 )
return true;
const wizard_data *imm;
if( !ch || !( imm = wizard( ch ) ) )
return false;
if( is_god( ch ) )
return true;
for( int i = 0; i < 2; ++i )
if( imm->pcdata->pfile->permission[i] & flag[i] )
return true;
if( msg )
send( ch, "Permission denied.\n\r." );
return false;
}
bool privileged( const char_data *ch, int level )
{
if( !ch || ch->species || ch->Level( ) < level )
return false;
return !is_set( ch->pcdata->pfile->flags, PLR_NO_PRIVILEGES );
}
/*
* FIND LOCATION
*/
static room_data *find_location( char_data* ch, const char *argument )
{
int i;
if( number_arg( argument, i ) )
return get_room_index( i );
char_data *victim;
if( ( victim = one_character( ch, argument, empty_string,
(thing_array*) &player_list,
(thing_array*) &mob_list ) ) )
return victim->in_room;
return 0;
}
/*
* TRUST
*/
void do_trust( char_data *ch, const char *argument )
{
char arg [ MAX_INPUT_LENGTH ];
player_data* victim;
int level;
in_character = false;
argument = one_argument( argument, arg );
if( !*arg
|| !*argument
|| !number_arg( argument, level ) ) {
send( ch, "Syntax: trust <char> <level>.\n\r" );
return;
}
if( !( victim = one_player( ch, arg, "trust",
(thing_array*) &player_list ) ) )
return;
if( level < 0 || level > MAX_LEVEL ) {
send( ch, "Level must be 0 (reset) or 1 to %d.\n\r", MAX_LEVEL );
return;
}
if( level > get_trust( ch ) ) {
fsend( ch, "You can't trust %s beyond your trust level %d.",
victim, get_trust( ch ) );
return;
}
/*
if( level != 0 && level < victim->Level() ) {
send( ch, "You can't trust %s less than %s experience level %d.\n\r",
victim, victim->His_Her(), ch->Level() );
return;
}
*/
if( wizard_data *wiz = wizard( victim ) ) {
wiz->wizinvis = max( wiz->wizinvis, level );
}
fsend( victim, "You are now trusted at level %d.", level );
if( ch != victim )
fsend( ch, "%s is now trusted at level %d.",
victim->real_name( ), level );
player_log( victim, "Trust set from level %d to level %d by %s.",
victim->pcdata->trust,
level,
ch->real_name( ) );
player_log( ch, "Trusted %s from level %d to level %d.",
victim->real_name( ),
victim->pcdata->trust,
level );
victim->pcdata->trust = level;
modify_pfile( victim );
victim->Save( );
}
/*
* REIMB FUNCTION
*/
void do_reimburse( char_data* ch, const char *argument )
{
char_data* victim;
int flags;
in_character = false;
if( mortal( ch, "reimburse" ) )
return;
if( !get_flags( ch, argument, &flags, "delDrRwEW", "reimburse" ) )
return;
if( !( victim = one_player( ch, argument, "reimburse",
ch->array ) ) )
return;
if( victim == ch ) {
send( ch, "You can't reimburse yourself.\n\r" );
return;
}
if( flags == 0 ) {
send( ch, "You must specify what to reimburse, see help.\n\r" );
return;
}
if( is_set( flags, 4 )
|| is_set( flags, 5 ) ) {
int level = is_set( flags, 5 ) ? ( victim->Level() ) : ( victim->Level( ) - 1 );
level = max( 1, level );
int exp = exp_for_level( level )/5;
fsend( ch, "You charge %s for %d exp and one death.",
victim, exp );
fsend_color( victim, COLOR_WIZARD, "%s charges you for %d exp and one death.",
ch, exp );
player_log( victim, "Charged 1 death, %d exp by %s.",
exp, ch->real_name( ) );
++victim->shdata->deaths;
add_exp( victim, -exp );
return;
}
if( is_set( flags, 0 )
|| is_set( flags, 3 ) ) {
int level = is_set( flags, 3 ) ? ( victim->Level() + 1 ) : ( victim->Level( ) );
int exp = exp_for_level( level )/5;
fsend( ch, "You reimburse %s for %d exp and one death.",
victim, exp );
fsend_color( victim, COLOR_WIZARD, "%s reimburses you for %d exp and one death.",
ch, exp );
player_log( victim, "Reimbursed 1 death, %d exp by %s.",
exp, ch->real_name( ) );
--victim->shdata->deaths;
add_exp( victim, exp );
return;
}
link_data link;
if( !load_char( &link, victim->descr->name, BACKUP_DIR ) ) {
send( ch, "No backup of that player found.\n\r" );
return;
}
if( is_set( flags, 7 )
|| is_set( flags, 8 ) ) {
bool found = false;
for( int i = 0; i < link.player->followers; ++i ) {
thing_array *array = is_set( flags, 7 )
? &link.player->followers[i]->contents
: &link.player->followers[i]->wearing;
if( !array->is_empty() ) {
found = true;
for( int i = array->size - 1; i >= 0; --i ) {
thing_data *thing = array->list[i];
thing = thing->From( thing->Number( ) );
thing->To( *ch->array );
}
}
}
if( found ) {
const char *drop = ch->in_room->drop( );
send( ch, "You scan the annals of history ...\n\r" );
if( *drop ) {
fsend( ch, "Finding the status of %s from earlier times you\
duplicate %s equipment, dropping it %s.",
victim, victim->His_Her( ), drop );
} else {
fsend( ch, "Finding the status of %s from earlier times you\
duplicate %s equipment, and drop it.",
victim, victim->His_Her( ) );
}
fsend_color( victim, COLOR_WIZARD, "You feel %s probing your history ...", ch );
fsend_color( victim, COLOR_WIZARD,
"With a sweep of %s arms %s produces your old equipment.",
ch->His_Her( victim ), ch->He_She( victim ) );
} else {
fsend( ch, "The backup file shows no equipment for %s.", victim );
}
} else {
thing_array *array = ( is_set( flags, 1 )
? &link.player->contents
: ( is_set( flags, 6 )
? &link.player->wearing
: &link.player->locker ) );
if( array->is_empty() ) {
fsend( ch, "The backup file shows no equipment for %s.", victim );
} else {
for( int i = array->size - 1; i >= 0; --i ) {
thing_data *thing = array->list[i];
thing = thing->From( thing->Number( ) );
thing->To( *ch->array );
}
const char *drop = ch->in_room->drop( );
send( ch, "You scan the annals of history ...\n\r" );
if( *drop ) {
fsend( ch, "Finding the status of %s from earlier times you\
duplicate %s equipment, dropping it %s.",
victim, victim->His_Her( ), drop );
} else {
fsend( ch, "Finding the status of %s from earlier times you\
duplicate %s equipment, and drop it.",
victim, victim->His_Her( ) );
}
fsend_color( victim, COLOR_WIZARD, "You feel %s probing your history ...", ch );
fsend_color( victim, COLOR_WIZARD,
"With a sweep of %s arms %s produces your old equipment.",
ch->His_Her( victim ), ch->He_She( victim ) );
}
}
link.player->Extract( );
extracted.delete_list();
}
/*
* ROUTINES TO DEAL WITH MALCONTENTS
*/
static bool deny_loop( char_data *ch, int flag, const char *title )
{
bool found = false;
int trust = get_trust( ch );
for( int i = 0; i < max_pfile; ++i ) {
pfile_data *pfile = pfile_list[i];
if( pfile->trust < trust
&& is_set( pfile->flags, flag ) ) {
if( !found ) {
page_title( ch, title );
page_underlined( ch, "%-14s %-20s %s\n\r", "Player", "Account", "Last On" );
found = true;
}
page( ch, "%-14s %-20s %s\n\r",
pfile->name, pfile->account->name, ltime( pfile->last_on, false, ch )+4 );
}
}
return found;
}
void do_deny( char_data *ch, const char *argument )
{
in_character = false;
int flags;
if( !get_flags( ch, argument, &flags, "ramn", "deny" ) ) {
return;
}
if( !*argument ) {
bool found = deny_loop( ch, PLR_DENY, "Players Denied Connection" );
found = deny_loop( ch, PLR_NO_AUCTION, "Players Denied Auction" ) || found;
found = deny_loop( ch, PLR_NO_MAIL, "Players Denied Mail" ) || found;
found = deny_loop( ch, PLR_NO_NOTES, "Players Denied Noteboards" ) || found;
if( !found )
send( ch, "No players are currently denied.\n\r" );
return;
}
pfile_data *pfile = find_pfile( argument, ch );
if( !pfile )
return;
if( pfile == ch->pcdata->pfile ) {
send( ch, "You cannot deny yourself.\n\r" );
return;
}
if( pfile->trust >= get_trust( ch ) ) {
fsend( ch, "You cannot deny %s.", pfile->name );
return;
}
const char *name;
int flag;
if( is_set( flags, 1 ) ) {
name = "auction";
flag = PLR_NO_AUCTION;
} else if( is_set( flags, 2 ) ) {
name = "mail";
flag = PLR_NO_MAIL;
} else if( is_set( flags, 3 ) ) {
name = "noteboards";
flag = PLR_NO_NOTES;
} else {
name = "connection";
flag = PLR_DENY;
}
if( is_set( flags, 0 ) && !is_set( pfile->flags, flag ) ) {
fsend( ch, "Player \"%s\" is not currently denied %s.", pfile->name, name );
return;
} else if( !is_set( flags, 0 ) && is_set( pfile->flags, flag ) ) {
fsend( ch, "Player \"%s\" is already denied %s.", pfile->name, name );
return;
}
bool loaded = false;
player_data *pc = find_player( pfile );
if( !pc ) {
link_data link;
link.connected = CON_PLAYING;
if( !load_char( &link, pfile->name, PLAYER_DIR ) ) {
bug( "Load_Char: error reading player file. (%s)", pfile->name );
return;
}
pc = link.player;
loaded = true;
}
char *tmp = static_string( );
if( is_set( flags, 0 ) ) {
remove_bit( pfile->flags, flag );
fsend( ch, "Player \"%s\" is no longer denied %s.", pfile->name, name );
char *tmp = static_string( );
snprintf( tmp, THREE_LINES, "%s un-denied %s by %s.",
pc->descr->name, name, ch->Name() );
if( !loaded ) {
send( pc, "\n\r" );
send_color( pc, COLOR_WIZARD, "Your %s privileges have been restored.", name );
send( pc, "\n\r" );
pc->Save( );
}
} else {
set_bit( pfile->flags, flag );
fsend( ch, "Player \"%s\" is now denied %s.", pfile->name, name );
snprintf( tmp, THREE_LINES, "%s denied %s by %s.",
pc->descr->name, name, ch->Name() );
if( !loaded ) {
if( flag == PLR_DENY ) {
send( pc, "\n\r" );
send_color( pc, COLOR_WIZARD, "You have earned the displeasure of the gods." );
send( pc, "\n\r" );
send_color( pc, COLOR_WIZARD, "Your character is now denied access." );
send( pc, "\n\r" );
forced_quit( pc );
} else {
send( pc, "\n\r" );
send_color( pc, COLOR_WIZARD, "Your %s privileges have been revoked.", name );
send( pc, "\n\r" );
pc->Save( );
}
}
}
if( loaded ) {
send( ch, "\n\r" );
send_centered( ch, "[ Player file was loaded from disk. ]" );
pc->Save( false );
pc->Extract();
extracted.delete_list();
}
info( get_trust( ch ), empty_string, 0, tmp, IFLAG_ADMIN, 1, ch );
}
void disconnect( char_data *victim, char_data *ch )
{
if( ch && get_trust( victim ) >= get_trust( ch ) ) {
send( ch, "You can only disconnect those of lower trust.\n\r" );
return;
}
if( !victim->link ) {
if( ch )
fsend( ch, "%s doesn't have a descriptor.", victim );
return;
}
close_socket( victim->link, true );
if( ch )
fsend( ch, "Closed %s's socket.", victim );
char *tmp = static_string( );
if( ch ) {
snprintf( tmp, THREE_LINES, "%s disconnected by %s.",
victim->descr->name, ch->Name() );
} else {
snprintf( tmp, THREE_LINES, "%s disconnected.",
victim->descr->name );
}
info( get_trust( ch ), empty_string, 0, tmp, IFLAG_ADMIN, 1, ch );
}
void do_disconnect( char_data *ch, const char *argument )
{
in_character = false;
char_data *victim;
if( !( victim = one_player( ch, argument, "disconnect",
(thing_array*) &player_list ) ) )
return;
disconnect( victim, ch );
}
void do_imprison( char_data *ch, const char *argument )
{
// in_character = false;
if( !*argument ) {
send( ch, "Syntax: imprison <player>\n\r" );
return;
}
pfile_data *pfile = find_pfile_exact( argument );
if( !pfile ) {
send( ch, "No such player found.\n\r" );
send( ch, "The name must be spelled exactly and completely.\n\r" );
return;
}
if( pfile == ch->pcdata->pfile ) {
send( ch, "You cannot imprison yourself.\n\r" );
return;
}
if( pfile->trust >= get_trust( ch ) ) {
fsend( ch, "You cannot imprison %s.", pfile->name );
return;
}
bool loaded = false;
player_data *pc = find_player( pfile );
if( !pc ) {
link_data link;
link.connected = CON_PLAYING;
if( !load_char( &link, pfile->name, PLAYER_DIR ) ) {
bug( "Load_Char: error reading player file. (%s)", pfile->name );
return;
}
pc = link.player;
loaded = true;
}
room_data *from = pc->in_room;
if( !from
&& !( from = pc->was_in_room ) ) {
fsend( ch, "%s cannot be imprisoned, since they are not yet in the game.", pfile->name );
} else if( from->vnum == ROOM_PRISON ) {
fsend( ch, "%s is already imprisoned. Maybe you should apply thumbscrews?", pfile->name );
} else {
dismount( pc );
if( pc->leader )
stop_follower( pc );
fsend_color_seen( pc, COLOR_WIZARD, "%s is mercilessly vaporized.", pc );
if( pc->array )
pc->From( );
pc->To( get_room_index( ROOM_PRISON ) );
// set_bit( pc->pcdata->pfile->flags, PLR_FREEZE );
fsend_color_seen( pc, COLOR_WIZARD, "%s joins you in your penance.", pc );
send_color( pc, COLOR_WIZARD, "You have been imprisoned!" );
send( pc, "\n\r" );
leave_shadows( pc );
pc->set_default_title( );
if( pc->in_room ) {
send( pc, "\n\r" );
show_room( pc, pc->in_room, false, false );
}
fsend( ch, "%s imprisoned from %s (%d).",
pc->descr->name, from->name, from->vnum );
char *tmp = static_string( );
snprintf( tmp, THREE_LINES, "%s imprisoned by %s from %s (%d).",
pc->descr->name, ch->Name( ), from->name, from->vnum );
info( get_trust( ch ), empty_string, 0, tmp, IFLAG_ADMIN, 1, ch );
player_log( pc, "Imprisoned from %s (%d) by %s.",
from->name, from->vnum,
ch->descr->name );
player_log( ch, "Imprisoned %s from %s (%d).",
pc->descr->name,
from->name, from->vnum );
pc->Save( false );
}
if( loaded ) {
send( ch, "\n\r" );
send_centered( ch, "[ Player file was loaded from disk. ]" );
pc->Extract();
extracted.delete_list();
}
/*
player_data *victim;
if( !( victim = one_player( ch, argument, "imprison",
(thing_array*) &player_list ) ) )
return;
if( victim == ch ) {
send( ch, "You can't imprison yourself!\n\r" );
return;
}
if( get_trust( victim ) >= get_trust( ch ) ) {
send( ch,
"You can't imprison someone of equal or higher trust level.\n\r" );
return;
}
room_data *from = victim->in_room;
if( !from ) {
send( ch, "They are in limbo.\n\r" );
return;
}
dismount( victim );
if( victim->leader )
stop_follower( victim );
fsend_color_seen( victim, COLOR_WIZARD, "%s is mercilessly vaporized.", victim );
victim->From( );
victim->To( get_room_index( ROOM_PRISON ) );
// set_bit( victim->pcdata->pfile->flags, PLR_FREEZE );
fsend_color_seen( victim, COLOR_WIZARD, "%s joins you in your penance.", victim );
send_color( victim, COLOR_WIZARD, "You have been imprisoned!" );
leave_shadows( victim );
victim->set_default_title( );
victim->Save( );
send( victim, "\n\r" );
show_room( victim, victim->in_room, false, false );
fsend( ch, "%s imprisoned from %s (%d).",
victim, from->name, from->vnum );
char *tmp = static_string( );
snprintf( tmp, THREE_LINES, "%s imprisoned by %s from %s (%d).",
victim->Name(), ch->Name(), from->name, from->vnum );
info( get_trust( ch ), empty_string, 0, tmp, IFLAG_ADMIN, 1, ch );
player_log( victim, "Imprisoned from %s (%d) by %s.",
from->name, from->vnum,
ch->descr->name );
player_log( ch, "Imprisoned %s from %s (%d).",
victim->descr->name,
from->name, from->vnum );
*/
}
void do_pardon( char_data* ch, const char *argument )
{
/*
char_data *victim;
int i;
in_character = false;
if( !( victim = one_player( ch, argument, "pardon",
(thing_array*) &player_list ) ) )
return;
if( get_trust( victim ) > get_trust( ch ) ) {
send( ch,
"You can only pardon those of lower or equal level.\n\r" );
return;
}
for( i = 0; i < table_max[ TABLE_NATION ]; i++ )
victim->pcdata->pfile->reputation[i] = 500;
if( ch != victim ) {
send_color( victim, COLOR_WIZARD, "%s has pardoned you.", ch );
send( victim, "\n\r" );
}
send( ch, "Ok.\n\r" );
char *tmp = static_string( );
snprintf( tmp, THREE_LINES, "%s pardoned by %s.",
victim->Name(), ch->Name() );
info( get_trust( ch ), empty_string, 0, tmp, IFLAG_ADMIN, 1, ch );
*/
}
void do_freeze( char_data *ch, const char *argument )
{
player_data* victim;
in_character = false;
if( !( victim = one_player( ch, argument, "pardon",
(thing_array*) &player_list ) ) )
return;
if( get_trust( ch ) <= get_trust( victim ) ) {
send( ch, "You failed.\n\r" );
return;
}
switch_bit( victim->pcdata->pfile->flags, PLR_FREEZE );
char *tmp = static_string( );
if( is_set( victim->pcdata->pfile->flags, PLR_FREEZE ) ) {
send_color( victim, COLOR_WIZARD, "You can't do anything!" );
send( victim, "\n\r" );
send( ch, "FREEZE set.\n\r" );
snprintf( tmp, THREE_LINES, "%s frozen by %s.",
victim->Name(), ch->Name() );
} else {
send_color( victim, COLOR_WIZARD, "You can play again." );
send( victim, "\n\r" );
send( ch, "FREEZE removed.\n\r" );
snprintf( tmp, THREE_LINES, "%s unfrozen by %s.",
victim->Name(), ch->Name() );
}
info( get_trust( ch ), empty_string, 0, tmp, IFLAG_ADMIN, 1, ch );
victim->Save( );
}
void do_peace( char_data* ch, const char *)
{
if( mortal( ch, "peace" ) )
return;
send( ch, "You wave your hand in a gesture for silence.\n\r" );
fsend_color_seen( ch, COLOR_WIZARD, "%s waves %s hand in a gesture for silence.",
ch, ch->His_Her( ) );
for( int i = 0; i < *ch->array; i++ ) {
if( char_data *rch = character( ch->array->list[i] ) ) {
remove_bit( rch->status, STAT_BERSERK );
remove_bit( rch->status, STAT_FOCUS );
set_fighting( rch, 0 );
rch->aggressive.clear( );
stop_events( rch, execute_leap );
disrupt_spell( rch );
}
}
}
/*
* BAMFIN/BAMFOUT
*/
static const char* bamfin( wizard_data* wizard )
{
char* b = wizard->bamfin != empty_string ? wizard->bamfin : "materializes from the ether.";
char value [ MAX_STRING_LENGTH ];
convert_to_ansi( wizard, MAX_STRING_LENGTH, b, value );
return value;
}
static const char* bamfout( wizard_data* wizard )
{
char* b = wizard->bamfout != empty_string ? wizard->bamfout : "disappears into the ether.";
char value [ MAX_STRING_LENGTH ];
convert_to_ansi( wizard, MAX_STRING_LENGTH, b, value );
return value;
}
void do_bamfin( char_data* ch, const char *argument )
{
wizard_data* imm = wizard( ch );
if( !imm )
return;
free_string( imm->bamfin, MEM_WIZARD );
imm->bamfin = alloc_string( argument, MEM_WIZARD );
send( ch, "Bamfin message set to:\n\r" );
const char *bamf = bamfin( imm );
fsend( ch, "%s", bamf );
}
void do_bamfout( char_data *ch, const char *argument )
{
wizard_data* imm = wizard( ch );
if( !imm )
return;
free_string( imm->bamfout, MEM_WIZARD );
imm->bamfout = alloc_string( argument, MEM_WIZARD );
send( ch, "Bamfout message set to:\n\r" );
const char *bamf = bamfout( imm );
fsend( ch, "%s", bamf );
}
/*
* GOTO
*/
static void exec_goto( char_data* victim, room_data* room, wizard_data* imm )
{
victim->Select( 1 );
if( imm )
{
const char *bamf = bamfout( imm );
fsend_seen( victim, "%s", bamf );
}
else
{
fsend_color_seen( victim, COLOR_WIZARD, "%s suddenly disappears!", victim );
}
victim->From( );
victim->To( room );
if( imm )
{
const char *bamf = bamfin( imm );
fsend_seen( victim, "%s", bamf );
}
else
{
fsend_color_seen( victim, COLOR_WIZARD, "%s suddenly appears!", victim );
}
show_room( victim, room, false, false );
}
void raw_goto( wizard_data *imm, room_data *from, room_data *to )
{
if( from == to )
return;
exec_goto( imm, to, imm );
char_data *rch;
for( int i = from->contents-1; i >= 0; i-- )
if( ( rch = character( from->contents[i] ) )
&& rch->leader == imm
&& is_set( rch->status, STAT_PET ) )
exec_goto( rch, to, 0 );
}
void do_goto( char_data* ch, const char *argument )
{
wizard_data *imm;
if( !ch
|| !( imm = wizard( ch ) ) )
return;
if( !*argument ) {
send( ch, "Usage: goto <location>\n\r" );
return;
}
in_character = false;
room_data *to;
if( !( to = find_location( ch, argument ) ) ) {
send( ch, "No such location.\n\r" );
return;
}
in_character = true;
room_data *from;
if( ( from = ch->in_room ) == to ) {
send( ch, "You are already there!\n\r" );
return;
}
if( is_set( to->room_flags, RFLAG_OFFICE )
&& !is_demigod( ch )
&& to->vnum != imm->office ) {
send( ch, "That location belongs to another immortal.\n\r" );
return;
}
raw_goto( imm, from, to );
}
/*
* TRANSFER
*/
void transfer( char_data* ch, char_data* victim, room_data* room )
{
char tmp [ TWO_LINES ];
Content_Array* where = victim->array;
char_data* rch;
fsend_color_seen( victim, COLOR_WIZARD, "%s disappears in a mushroom cloud.", victim );
victim->From( );
victim->To( room );
fsend_color_seen( victim, COLOR_WIZARD, "%s arrives from a puff of smoke.", victim );
snprintf( tmp, TWO_LINES, "** %s has transferred you. **", ch->Name( victim ) );
tmp[3] = toupper( tmp[3] );
send_color( victim, COLOR_WIZARD, tmp );
send( victim, "\n\r\n\r" );
if( !victim->was_in_room ) {
show_room( victim, room, false, false );
}
for( int i = *where-1; i >= 0; i-- )
if( ( rch = character( where->list[i] ) )
&& rch->leader == victim
&& is_set( rch->status, STAT_PET ) )
transfer( ch, rch, room );
}
void do_transfer( char_data* ch, const char *argument )
{
wizard_data *imm;
if( !ch
|| !( imm = wizard( ch ) ) )
return;
char arg [ MAX_INPUT_LENGTH ];
char_data* victim;
player_data* player;
room_data* room;
argument = one_argument( argument, arg );
if( !*arg ) {