-
Notifications
You must be signed in to change notification settings - Fork 8
/
Aether Factions.txt
1736 lines (1235 loc) · 42.9 KB
/
Aether Factions.txt
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
/*
AETHER'S FACTION SYSTEM
Updated for TinyMUX and a non-Mistress-based system.
--> Aether's Factions Object <afo> created as object #2883
Requires the following user-defined functions:
isstaff() - nothing new under the sun
isfaction() - created in this very code
header() - generic output header
footer() - generic output footer
isapproved() - does what it says on the tin
pmatch() - this one might slip in there, so watch out for it
Requires the following considerations:
create() - must be wiz-okay
Stores on the Player:
_faction-member: <X>!<#dbref>|...
X: H if ooc administrator, N if normal member, either/or
Stores on the Faction Object:
d_created-by: dbref of the staffer who created the faction
information: if exists, a summary of the faction, set by faction heads
member-<dbref>[-<rank>]: <dbref>[/<title>]
================================================================================
== Setup =======================================================================
@create Aether Faction Object <afo>
@fo me=&d.afo me=[search( name=Aether Faction Object <afo> )]
@set Aether Faction Object <afo>=INHERIT SAFE
@fo me=@parent Aether Faction Object <afo>=
[search( name=Code Object Data Parent <codp> )]
&.msg [v( d.afo )]=ansi( h, <%0>, n, %b%1 )
/*
Include the following if you allow Wizards access to @function:
@Startup [v( d.afo )]=@function/preserve/privileged isfaction?=%!/f.isfaction?
@trig [v( d.afo )]/startup
*/
================================================================================
== Pseudo-Mistress Set-Up ======================================================
Calls:
c.<name>.default: When '+<name>' is typed
c.<name>.specific: When '+<name> <more>' is typed
c.<name>/<switch>: When '+<name>/<switch> [<more>]' is typed
0: All input
n: Name of the command for finding 'c.<name>.default', et al. ( portability )
*/
&c.faction [v( d.afo )]=$^\+?factions?([^ ]*)$:@pemit %#=
[setq( n, faction )]
[switch( %1,
// Without 's' ending
, u( c.%qn.default ),
/*, u( c.%qn.switch, first( %1 ), rest( %1 )),
%b*, u( c.%qn.specific, trim( %1 )),
// With 's' ending
s, u( c.%qn.default ),
s/*, u( c.%qn.switch, /[first( after( %1, / ))], rest( %1 )),
s%b*, u( c.%qn.specific, trim( rest( %1 ))),
// No match
u( .msg, faction,
I don't know what you mean.
Please see: [ansi( h, +help %qn )]
)
)]
// --
@set afo/c.faction=regexp
/*
--------------------------------------------------------------------------------
-- c.faction.switch ------------------------------------------------------------
Handles all /switches, which is to say it makes sure they exist and
passes them on.
0: /<switch>
1: [<more>], stuff to pass to c.<name>/<switch>, if any
qn: Name of the command, global register set in &c.<name> ( above )
*/
&c.faction.switch [v( d.afo )]=
udefault(
first( sort( lattr( %!/c.%qn*%0* ))),
u( .msg, secure( %qn ), No such switch ),
%1
)
/*
--------------------------------------------------------------------------------
-- c.faction.default -----------------------------------------------------------
faction -> faction/list
*/
&c.faction.default [v( d.afo )]=u( c.faction/list )
/*
--------------------------------------------------------------------------------
-- c.faction.specific ----------------------------------------------------------
Set it up so that you're searching for any word in a multi-word faction i.e., A
faction named 'Jane's House of Horrors' will match on 'Jane', 'House', 'Horrors'
or even 'Of'. 'grab' always grabs the FIRST match. Does partial name matches,
too. So 'faction hou' might get it, too.
Warning: This MAY be the only function that has 'middle name matching' on
factions. If you want the long story as to the confusion, it's long. In general,
assume only where you're sure you can fix a problem.
0: faction name
q0: List of ' <name>:<dbref>|...' that the user can-see
q1: Single matching '<name>:<dbref>'
uses: isstaff(), isfaction?()
*/
&c.faction.specific [v( d.afo )]=
// The Partial/In-Name Match
[setq( 0,
iter(
filter( fil.see-faction, lcon( %! ), , , %# ),
%b[name( %i0 )]:%i0,
, |
)
)]
[setq( 1, trim( grab( %q0, * %0*:*, | )))]
[case( 0,
t( %q1 ), I can't find any faction by that name.,
u( f.display.roster, last( %q1, : ))
)]
/*
================================================================================
== faction/create ==============================================================
Creates an object within the faction code object that stores all the faction
information. Removing a faction is simply deleting the object. Making a faction
secret is simply setting it dark.
Creating a faction may *only* be done by a Wizard.
--
0: <name>[ = <faction head>]
qn: name of faction
qh: 1 if trying to set a faction head, 0 otherwise
qc: character dbref of initial faction head
qo: dbref of created faction object
*/
&c.faction/create [v( d.afo )]=
[setq( n, trim( before( %0, = )))]
[setq( h, comp( trim( after( %0, = )), ))]
[setq( c, pmatch( trim( after( %0, = ))))]
[case( 0,
isstaff( %# ),
u( .msg, faction, You can't create factions ),
or( not( %qh ), isdbref( %qc )),
u( .msg, faction, That player does not exist ),
or( not( %qh ), isapproved( %qc, approved )),
u( .msg, faction, That player is not approved ),
valid( %qn, thingname ),
u( .msg, faction, That's not a good name for a faction ),
not( isdbref( num( %qn ))),
u( .msg, faction,
A faction already exists with that name%, or close
),
// No Errors: Make That Faction
[setq( o, create( %qn, 10 ))]
[set( %qo, d_created-by:%# )]
// .. did you try to make a faction head?
[if( %qh,
// .. .. yes
[set( %qc,
_faction-member:[setunion( H!%qo, u( %qc/_faction-member ), | )]
)]
[u( f.member.add, %qc, %qo )]
[u( .msg, faction,
Faction '%qn' created with faction head [name( %qc )]
)],
// .. .. no
u( .msg, faction,
Faction '%qn' created without a faction head
)
)]
)]
/*
================================================================================
== faction/destroy =============================================================
Clears everyone from the faction and destroys it. Staff-only.
If the output looks odd, because some rosters are too large for the lbuf to
handle, but list() avoids the output queue altogether. So to get the timing
right, each output element is wrapped in a list().
--
0: <faction name>[=YES]
f: faction dbref
y: true if =YES was entered
l: list of members
d: attribute list
r: rank, if any
t: title, if any
*/
&c.faction/destroy [v( d.afo )]=
[setq( f, num( trim( first( %0, = ))))]
[setq( y, not( comp( rest( %0, = ), YES )))]
[case( 0,
isstaff( %# ),
u( .msg, faction/destroy, Staff only. ),
isdbref( %qf ),
u( .msg, faction/destroy, Could not find that faction. ),
not( hasflag( %qf, going )),
u( .msg, faction/destroy, Faction is already destroyed ),
%qy,
u( .msg, faction/destroy,
If you're absolutely sure%, type: faction/destroy [name( %qf )]=YES
),
[setq( l, u( f.faction.roster, %qf ))]
// >> header
[list( 1,
header( faction/destroy: [name( %qf )] ( %qf ))
)]
// >> roster
[list( %ql,
[setq( d, first( lattr( %qf/member-%i0* )))]
[setq( r, extract( %qd, 3, 1, - ))]
[setq( t, rest( get( %qf/%qd ), / ))]
// .. report
%b [name( %i0 )] -
Title: [if( t( %qt ), %qt, none )] -
Rank: [if( t( %qt ), %qr, none )]
// .. remove character
[u( f.member.remove, %i0, %qf )]
)]
// >> footer
[list( 1,
%b Information: [udefault( %qf/information, ( Not Set ))]%r %r
%b Created By: [name( get( %qf/d_created-by ))] ( [get( %qf/d_created-by )] )%r
[footer( [words( %ql )] members removed )]
[destroy( %qf )]
)]
)]
/*
================================================================================
== faction/undestroy ==========================================================
Because the factions are objects, they will be marked 'going' until the system cleanup kicks in. Unset the 'going' flag.
NOTE TO SELF: locate() is better than num(), as you control where you look
0: <faction name>
f: faction dbref
e: possible error from 'set'
*/
&c.faction/undestroy [v( d.afo )]=
[setq( f, locate( %!, %0, i ))]
[case( 0,
isstaff( %# ),
u( .msg, faction/undestroy, Staff only ),
comp( %qf, #-1 ),
u( .msg, faction/undestroy, Could not find that faction ),
comp( %qf, #-2 ),
u( .msg, faction/undestroy, Too many factions matched ),
hasflag( %qf, GOING ),
u( .msg, faction/undestroy,
Faction '[name( %qf )]' is not being destroyed
),
// set !going, check for error
[not( strlen( setr( e, set( %qf, !GOING ))))],
u( .msg, faction/undestroy, !Going Failed: %qe ),
u( .msg, faction/undestroy, [name( %qf )] saved from deletion )
)]
/*
================================================================================
== faction/list ================================================================
New with headers for faction types.
qf: factions %# can see
qt: list|of|faction|types
*/
&c.faction/list [v( d.afo )]=
[setq( f, filter( fil.see-faction, lcon( %! ), , , %# ))]
[setq( t, setunion( lcstr( iter( %qf, get( %i0/d_type ), , | )), , | ))]
[header( Factions )]%r
[case( 0,
// .. no factions visible
words( %qf ), %b ( No factions to display ),
// .. no faction types, display all by alpha sort
words( %qt, | ),
u( f.display.one-faction-group, %qf ),
// .. faction types, display one at a time starting with 'no type'
iter( %qt,
[divider( if( comp( %i0, ), lcstr( %i0 ), ( no type )))]%r
[u( f.display.one-faction-group,
filter( fil.faction-type, %qf, , , %i0 )
)],
|, @@
)
)]%r
[footer( words( %qf ))]
/*
--------------------------------------------------------------------------------
-- Display: One Faction Group --------------------------------------------------
0: list of faction objects ( by dbref )
ql: list of factions to show
*/
&f.display.one-faction-group [v( d.afo )]=
[setq( l,
iter( sortby( f.sortby.object-name, %0 ),
[if( hasflag( %i0, DARK ),
ansi( xh, %[ [name( %i0 )] %] ),
name( %i0 )
)],
, |
)
)]
[columns( %ql, 38, |, 2 )]
/*
--------------------------------------------------------------------------------
-- Sortby: Object Name ---------------------------------------------------------
*/
&f.sortby.object-name [v( d.afo )]=comp( name( %0 ), name( %1 ))
/*
--------------------------------------------------------------------------------
-- Filter: Faction Type --------------------------------------------------------
*/
&fil.faction-type [v( d.afo )]=strmatch( get( %0/d_type ), %1 )
/*
================================================================================
== Display: Roster =============================================================
If the use of list() here looks odd, it's because list() skips the queue. By forcing all output into list(), it's processed in the proper order.
--
0: roster dbref
qp: player dbref
qr: rank, if any
qt: title, if any
qs: permissions list
*/
&f.display.roster [v( d.afo )]=
[list( 1,
[header( [name( %0 )][if( isstaff( %# ), %b%( %0% ))] )]%r
%b [ljust( Name, 25 )] [ljust( Title, 45 )] Rank%r
%b[ansi( g, repeat( -, 77 ))]
)]
// >> each line, sorted by rank
[list(
setr( m, sortby( f.sortby.rank, lattr( %0/member-* ))),
[setq( p, extract( %i0, 2, 1, - ))]
[setq( r, extract( %i0, 3, 1, - ))]
[setq( t, after( get( %0/%i0 ), / ))]
[if( u( f.factionhead?, %qp, %0 ), >, %b )]
[ljust( name( %qp ), 25 )]
[ljust( %qt, 45 )]
[center( %qr, 4 )]
)]
[list( 1,
// >> info
%b[ansi( g, repeat( -, 77 ))]%r
[wrap(
udefault( %0/information, No Information Set. ),
76, , %b%b
)]%r
// >> report who can see, if faction dark, has permissions, & facthead/staff
[if(
and(
t( setr( s, get( %0/d_view-permission ))),
cor(
t( match( get( %#/_faction-member ), ?!%0, | )),
isstaff( %# )
),
// u( f.factionhead?, %#, %0 ),
or( isstaff( %# ), hasflag( %0, dark ))
),
%b[ansi( g, repeat( -, 77 ))]%r
[setq( s,
iter( %qs,
switch( %i0,
faction:*, Faction is [titlestr( rest( %i0, : ))],
sphere:*, Sphere is [titlestr( rest( %i0, : ))],
attribute:*:*,
Attribute '[lcstr( elements( %i0, 2, : ))]'
is set to '[lcstr( last( %i0, : ))]',
attribute:*,
Attribute '[lcstr( rest( %i0, : ))]' exists,
Unknown permission '[lcstr( first( %i0, : ))]'
),
|, |
)
)]
%b View Permissions
[if( not( hasflag( %0, dark )), %b[ansi( xh, %(if set dark%) )] )]:
[itemize( %qs, | )]%r
)]
// >> footer
[footer( [words( %qm )] members )]
)]
/*
--------------------------------------------------------------------------------
-- Function: Faction Roster ----------------------------------------------------
List of dbrefs on the faction object as members.
0: faction dbref
*/
&f.faction.roster [v( d.afo )]=
iter(
sortby( f.sortby.rank, lattr( %0/member-* )),
extract( %i0, 2, 1, - )
)
/*
--------------------------------------------------------------------------------
-- Function: Sort by Rank ------------------------------------------------------
0: List Of Attributes (probably should be surrounded in a localize())
*/
&f.sortby.rank [v( d.afo )]=
[setq( 0, last( %0, - ))]
[setq( 1, last( %1, - ))]
[case( 1,
gt( %q0, %q1 ), -1,
eq( %q0, %q1 ), 0,
lt( %q0, %q1 ), 1
)]
/*
================================================================================
== faction/add =================================================================
Add someone to a faction. ( Only faction heads and staff may do this, so there's
no reason to check "see faction". )
0: <charname>=<faction name>
f: faction dbref
c: character dbref
// t: title - optional with rank - not used at the moment
// r: rank - optional with title - not used at the moment
a: faction head/staff?
*/
&c.faction/add [v( d.afo )]=
[setq( f, num( trim( first( first( %0, / ), = ))))]
[setq( c, pmatch( trim( rest( %0, = ))))]
// [setq( f, num( trim( rest( %0, = ))))]
// [setq( c, pmatch( trim( first( first( %0, / ), = ))))]
// [setq( t, extract( %qc, 2, 1, / ))]
[setq( r, )]
[case( 0,
t( %qf ),
u( .msg, faction/add, That faction does not exist ),
u( f.factionhead?, %#, %qf ),
u( .msg, faction/add, You are not a faction head for this faction ),
t( %qc ),
u( .msg, faction/add, Name specified is not a player ),
isapproved( %qc, approved ),
u( .msg, faction/add, Player is not approved ),
not( hasflag( %qf, going )),
u( .msg, faction/add,
Faction has been deleted and is waiting to be cleared
from the system
),
not( match( get( %qc/_faction-member ), ?!%qf, | )),
u( .msg, faction/add, Player is already a member of that faction ),
// if( t( %qr ), isint( %qr ), 1 ),
// u( .msg, faction/add, Rank must be numeric ),
// >> okay
// .. add member to function object and to member object
[u( f.member.add, %qc, %qf, %qr, %qt )]
[u( .msg, faction/add, [name( %qc )] added to faction '[name( %qf )]' )]
)]
/*
--------------------------------------------------------------------------------
-- Function: Add Member (to Faction) -------------------------------------------
A simple function to add someone, and details, to a specific faction. Won't set rank without faction and visa versa. Won't set on a dbref that's not a faction.
Use this for adding or removing someone whose rank/title is being changed, too, by deleting the attribute and re-adding it.
member-<#dbref>[-<rank>]: <#dbref>[/<title>]
0: dbref of member
1: dbref of faction
2: rank, optional ( to erase, pass '-' )
3: title, optional ( to erase, pass '-' )
qo: original attribute name
qn: new attribute name
qc: new attribute contents
*/
&f.member.add [v( d.afo )]=
localize(
// >> qn: Name of the attribute we'll be setting on the Faction Object
[setq( o, first( lattr( %1/member-%0* )))]
[setq( n,
case( 1,
// .. if rank is '-', remove it
strmatch( %2, - ), member-%0,
// .. if other rank passed, override original rank
t( %2 ), member-%0-%2,
// .. else if an attribute already exists, use that
t( %qo ), %qo,
// .. else create a new, empty attribute
member-%0
)
)]
// >> qc: Contents of the attribute we'll be setting on the Faction Object
[setq( c,
case( 1,
// .. if title is '-', remove it
strmatch( %3, - ), %0,
// .. else if a title passed, override original title
t( %3 ), %0/%3,
// .. else if something exists, use that, else use %0
default( %1/%qo, %0 )
)
)]
// >> Don't set anything if %1 isn't a Faction Object
[case( 1,
t( setinter( lcon( %! ), %1 )),
// .. remove any existing attribute and add the new one, built above
[if( t( %qo ), set( %1, %qo: ))][set( %1, %qn:%qc )]
// .. add Faction to Player Object if they don't already have it
[if(
not( t( match( get( %0/_faction-member ), ?!%1, | ))),
set(
%0,
_faction-member:
[setunion( get( %0/_faction-member ), N!%1, | )]
)
)],
#-2
)]
)
/*
================================================================================
== faction/remove ==============================================================
0: <person>=<faction name>
qf: faction dbref
qc: dbref - prefer character, but try everything
*/
&c.faction/remove [v( d.afo )]=
[setq( f, num( trim( before( %0, = ))))]
[setq( c, pmatch( trim( rest( %0, = ))))]
[setq( c, case( 1, t( %qc ), %qc, locate( %!, trim( rest( %0, = )), *P )))]
[case( 0,
isdbref( %qf ),
u( .msg, faction/remove, Faction name does not exist ),
isdbref( %qc ),
u( .msg, faction/remove, Could not find target ),
u( f.factionhead?, %#, %qf ),
u( .msg, faction/remove, You are not a faction head for that faction ),
// .. only staff may remove a member who is a faction head
or(
not( u( f.factionhead?, %qc, %qf )),
isstaff( %# )
),
u( .msg, faction/remove,
You cannot remove faction heads. Please ask staff
),
t( lattr( %qf/member-%qc* )),
u( .msg, faction/remove, Target is not part of the faction ),
// >> okay
[u( f.member.remove, %qc, %qf )]
[name( %qc )] has been removed from [name( %qf )].
)]
/*
--------------------------------------------------------------------------------
-- Function: Remove Member (from Faction) --------------------------------------
A simple function to add someone, and details, to a specific faction. Won't set
on a dbref that's not a faction.
0: dbref of member
1: dbref of faction
g: grab the matching -- member attribute, then N!#dbref or H!#dbref
*/
&f.member.remove [v( d.afo )]=
case( 1,
t( setinter( lcon( %! ), %1 )),
// >> Remove from Faction Object
// [setq( g, lattr( %1/member-%0* ))]
[setq( g, regrabi( lattr( %1/member-%0* ), member-%0( -.* )? ))]
[set( %1, %qg: )]
// >> Remove Faction to Player Object
[setq( g, grab( get( %0/_faction-member ), ?!%1, | ))]
[set( %0,
_faction-member:[remove( get( %0/_faction-member ), %qg, | )]
)],
#-2
)
/*
================================================================================
== faction/information =========================================================
Add or change information about the faction. ( Only faction heads and staff may do this, so there's no reason to check "see faction". )
0: <faction>=[<text>]
f: faction dbref
t: text, if any ( if none, clear )
*/
&c.faction/information [v( d.afo )]=
[setq( f, num( trim( before( %0, = ))))]
[setq( t, trim( rest( %0, = )))]
[case( 0,
u( f.factionhead?, %#, %qf ),
u( .msg, faction/info, You are not a faction head for this faction ),
[set( %qf, information:%qt )]
[u( .msg, faction/info,
The information paragraph for your faction has been recorded
)]
)]
/*
================================================================================
== faction/addhead =============================================================
Adds an OOC administrator for the faction
0: <person>=<faction name>
qf: faction dbref
qc: character dbref
*/
&c.faction/addhead [v( d.afo )]=
[setq( f, num( trim( rest( %0, = ))))]
[setq( c, pmatch( trim( before( %0, = ))))]
[case( 0,
isstaff( %# ),
u( .msg, faction/addhead, Only staff may add faction heads ),
isdbref( %qf ),
u( .msg, faction/addhead, Faction name does not exist ),
isdbref( %qc ),
u( .msg, faction/addhead, Could not find player ),
isapproved( %qc, approved ),
u( .msg, faction/addhead, Player not approved ),
not( t( match( get( %qc/_faction-member ), H!%qf, | ))),
u( .msg, faction, Player is already a faction head ),
// >> okay
// .. remove N! and add H! -- player doesn't need to be a member first
[set( %qc, _faction-member:
[setunion(
remove( u( %qc/_faction-member ), N!%qf, | ),
H!%qf,
|
)]
)]
[u( .msg, faction/addhead,
[name( %qc )] has been added to the list of heads
for '[name( %qf )]'
)]
)]
/*
================================================================================
== faction/removehead ==========================================================
Remove someone from the leadership and OOC administration of a particular
faction.
0: <person>=<faction name>
qf: faction dbref
qc: character dbref
*/
&c.faction/removehead [v( d.afo )]=
[setq( f, num( trim( rest( %0, = ))))]
[setq( c, pmatch( trim( before( %0, = ))))]
[case( 0,
isstaff( %# ),
u( .msg, faction/removehead, Only staff may remove faction heads ),
isdbref( %qf ),
u( .msg, faction/removehead, Faction name does not exist ),
isdbref( %qc ),
u( .msg, faction/removehead, Could not find player ),
t( match( get( %qc/_faction-member ), H!%qf, | )),
u( .msg, faction/removehead, Player is not a faction head ),
// >> okay
// .. remove H! and add N! -- player doesn't need to be a member first
[set( %qc, _faction-member:
[setunion(
remove( u( %qc/_faction-member ), H!%qf, | ),
N!%qf,
|
)]
)]
[u( .msg, faction/removehead,
[name( %qc )] has been removed from the list of heads
for '[name( %qf )]'
)]
)]
/*
================================================================================
== faction/[!]dark ============================================================
Set a faction dark, or unset its darkness.
0: <faction name>
qf: faction dbref
*/
&c.faction/dark [v( d.afo )]=
[setq( f, num( trim( %0 )))]
[case( 0,
isstaff( %# ),
u( .msg, faction/dark, Staff only ),
isdbref( %qf ),
u( .msg, faction/dark, Faction not found ),
[set( %qf, dark )]
[u( .msg, faction/dark,
Faction '[name( %qf )]' is set dark and may now only be seen
by staff and members
)]
)]
// --
&c.faction/!dark [v( d.afo )]=
[setq( f, num( trim( %0 )))]
[case( 0,
isstaff( %# ),
u( .msg, faction/!dark, Staff only ),
isdbref( %qf ),
u( .msg, faction/!dark, Faction not found ),
[set( %qf, !dark )]
[u( .msg, faction/!dark,
Faction '[name( %qf )]' is set un-dark and may be seen
by all players
)]
)]
/*
================================================================================
== faction/who =================================================================
aka fwho
0: optional faction name
qf: faction dbref
ql: list of visible people in that faction
*/
&c.faction/who [v( d.afo )]=
// >> find which faction you're a part of - first one if multiple
[setq( f,
ifelse(
strmatch( %0, ),
before( after( u( %#/_faction-member ), ! ), | ),
locate( me, %0, i )
)
)]
// >> list of visible targets
// .. could be a filter(), feeling lazy
[setq( l,
iter(
lattr( %qf/member-* ),
[setq( p, extract( %i0, 2, 1, - ))]
[if(
and(
hasflag( %qp, connected ),
or( orflags( %qp, !D ), isstaff( %# ))
),
%qp
)]
)
)]
[case( 0,
isdbref( %qf ),
u( .msg, faction, No faction by that name ),
u( fil.see-faction, %qf, %# ),
u( .msg, faction, No faction by that name ),
u( f.display.list-who, %qf, sortby( f.sortby.object-name, %ql ))
)]
/*
================================================================================
== faction/whoall ==============================================================
aka fwho/all
*/
&c.fwho [v( d.afo )]=$^\+?fwho(.*)$:@pemit %#=
[switch( %1,
/a*, u( c.faction/whoall, trim( rest( %0 ))),
u( c.faction/who, trim( %0 ))
)]
@set v( d.afo )/c.fwho=regexp
// --
&c.faction/whoall [v( d.afo )]=