-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathGroups - GROUP.txt
666 lines (400 loc) · 85.6 KB
/
Groups - GROUP.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
@@ DEPENDENCIES: Core
th u(NEWCOBJ,Group Management System <GROUP>,group,,,,WIZARD SAFE !NO_COMMAND,INHERIT SIDEFX SAFE)
th u(NEWCOBJ,Group Object Parent <GOP>,gop,u(cobj,group),,,WIZARD SAFE,INHERIT SIDEFX SAFE)
th u(NEWCOBJ,Division Object Parent <GOP>,dop,u(cobj,group),,,WIZARD SAFE,INHERIT SIDEFX SAFE)
&PERM [u(cobj,gop)]=@@ Empty attr for Rhost.
&RANK [u(cobj,gop)]=@@ Empty attr for Rhost.
&RANK`1`NAME [u(cobj,gop)]=Leader
&RANK`1`PERM [u(cobj,gop)]=MODERATE MANAGE BBADMIN IC OOC GEMIT REPADMIN RADIO
&RANK`1`NODELETE [u(cobj,gop)]=1
&RANK`2`NAME [u(cobj,gop)]=Second
&RANK`2`PERM [u(cobj,gop)]=MODERATE MANAGE BBADMIN IC OOC GEMIT REPADMIN RADIO
&RANK`2`NODELETE [u(cobj,gop)]=1
&RANK`3`NAME [u(cobj,gop)]=Officer
&RANK`3`PERM [u(cobj,gop)]=MODERATE MANAGE IC OOC REPADMIN RADIO
&RANK`3`NODELETE [u(cobj,gop)]=1
&RANK`4`NAME [u(cobj,gop)]=Member
&RANK`4`PERM [u(cobj,gop)]=
&RANK`4`NODELETE [u(cobj,gop)]=1
&RANK`ALL`PERM [u(cobj,gop)]=IC OOC REPORT RADIO
&SET [u(cobj,gop)]=@@ Empty attr for Rhost.
&GET`COLORIZE [u(cobj,gop)]=localize(ansi(u(GET`COLOR,%!),%0))
&GET`NAME [u(cobj,gop)]=localize(setq(gname,u(GET`COLORIZE,name(%!)))[if(%1,u(pueblize,%q<gname>,+group [name(%!)]),%q<gname>)])
&GET`COLOR [u(cobj,gop)]=u(strfirstof,u(groupcolor,%#,%!),default(%!/SET`COLOR,n))
&GET`ABBR [u(cobj,gop)]=u(GET`COLORIZE,default(%!/SET`ABBREVIATION,left(name(%!),3)))
&GET`LETTER [u(cobj,gop)]=u(GET`COLORIZE,if(strlen(v(SET`LETTER)),v(SET`LETTER),if(strlen(v(SET`ABBREVIATION)),left(v(SET`ABBREVIATION),1),left(name(%!),1))))
&GET`ABBREVIATION [u(cobj,gop)]=u(GET`COLORIZE,if(strlen(v(SET`ABBREVIATION)),v(SET`ABBREVIATION),if(strlen(v(SET`ABBREVIATION)),left(name(%!),1),left(name(%!),1))))
&SET`STARTRANK [u(cobj,gop)]=4
&SET`STARTRANK`DESC [u(cobj,gop)]=The Rank # for new members!
&SET`STARTRANK`TYPE [u(cobj,gop)]=RANK
&SET`IC [u(cobj,gop)]=1
&SET`IC`DESC [u(cobj,gop)]=Is the IC channel enabled?
&SET`OOC`TYPE [u(cobj,gop)]=BOOL
&SET`OOC [u(cobj,gop)]=1
&SET`OOC`DESC [u(cobj,gop)]=Is the OOC channel enabled?
&SET`OOC`TYPE [u(cobj,gop)]=BOOL
&SET`TIER [u(cobj,gop)]=0
&SET`TIER`DESC [u(cobj,gop)]=The Group's current Tier.
&SET`TIER`TIER [u(cobj,gop)]=INT
&SET`SYSALERT [u(cobj,gop)]=3
&SET`SYSALERT`DESC [u(cobj,gop)]=Players this rank or better will hear Group System Alerts.
&SET`SYSALERT`TYPE [u(cobj,gop)]=RANK
&SET`PRIVATE [u(cobj,gop)]=1
&SET`PRIVATE`DESC [u(cobj,gop)]=Private Groups are hidden from non-members.
&SET`PRIVATE`TYPE [u(cobj,gop)]=BOOL
&SET`COMMAND [u(cobj,gop)]=2
&SET`COMMAND`DESC [u(cobj,gop)]=Rank cutoff for being shown in the Divisional display mode.
&SET`COMMAND`TYPE [u(cobj,gop)]=RANK
&SET`OPEN_JOIN [u(cobj,gop)]=0
&SET`OPEN_JOIN`DESC [u(cobj,gop)]=If true, anyone can join the group without needing an invitation.
&SET`OPEN_JOIN`TYPE [u(cobj,gop)]=BOOL
&SET`COLOR`DESC [u(cobj,gop)]=Color code for the group's name. Also applies to Letter and Abbreviation.
&SET`COLOR`TYPE [u(cobj,gop)]=COLOR
&SET`LETTER`DESC [u(cobj,gop)]=A single letter that represents the group in displays.
&SET`LETTER`TYPE [u(cobj,gop)]=LETTER
&SET`ABBREVIATION`DESC [u(cobj,gop)]=At most 3 letters that represents the group in displays.
&SET`ABBREVIATION`TYPE [u(cobj,gop)]=WORD
&SET`CHANNELS`DESC [u(cobj,gop)]=|-delimited list of Channel names that will be auto-joined when a member is added to this group.
&SET`CHANNELS`TYPE [u(cobj,gop)]=LIST
&SET`DISPLAYMODE [u(cobj,gop)]=STANDARD
&SET`DISPLAYMODE`DESC [u(cobj,gop)]=Different Group display formatters. Choices are STANDARD and DIVISIONAL.
&SET`DISPLAYMODE`TYPE [u(cobj,gop)]=WORD
&SET`NOREPORT [u(cobj,gop)]=0
&SET`NOREPORT`DESC [u(cobj,gop)]=This Group will not appear in the Report system.
&SET`NOREPORT`TYPE [u(cobj,gop)]=BOOL
&SET`RADIOS [u(cobj,gop)]=
&SET`RADIOS`DESC [u(cobj,gop)]=|-separated List of Radio Channels to auto-link upon joining the group.
&SET`RADIOS`TYPE [u(cobj,gop)]=RADIOLIST
&RANK [u(cobj,dop)]=@@ Empty attr for Rhost.
&RANK`1`NAME [u(cobj,dop)]=Leader
&RANK`1`NODELETE [u(cobj,dop)]=1
&RANK`2`NAME [u(cobj,dop)]=Second
&RANK`2`NODELETE [u(cobj,dop)]=1
&RANK`3`NAME [u(cobj,dop)]=Officer
&RANK`3`NODELETE [u(cobj,dop)]=1
&RANK`4`NAME [u(cobj,dop)]=Member
&RANK`4`NODELETE [u(cobj,dop)]=1
&SET`STARTRANK [u(cobj,dop)]=4
&GET`COLORIZE [u(cobj,dop)]=localize(ansi(u(GET`COLOR,%!),%0))
&GET`NAME [u(cobj,dop)]=localize(setq(gname,u(GET`COLORIZE,name(%!)))[if(%1,u(pueblize,%q<gname>,+group [name(%!)]),%q<gname>)])
&GET`COLOR [u(cobj,dop)]=u(strfirstof,u(groupcolor,%#,%!),default(%!/SET`COLOR,n))
&GET`ABBR [u(cobj,dop)]=u(GET`COLORIZE,default(%!/SET`ABBREVIATION,left(name(%!),3)))
&GET`LETTER [u(cobj,dop)]=u(GET`COLORIZE,if(strlen(v(SET`LETTER)),v(SET`LETTER),if(strlen(v(SET`ABBREVIATION)),left(v(SET`ABBREVIATION),1),left(name(%!),1))))
&GET`ABBREVIATION [u(cobj,dop)]=u(GET`COLORIZE,if(strlen(v(SET`ABBREVIATION)),v(SET`ABBREVIATION),if(strlen(v(SET`ABBREVIATION)),left(name(%!),1),left(name(%!),1))))
@@ &COLOR`GROUP`NAME u(pco)=hx
@@ &COLOR`GROUP`ICNAME u(pco)=hx
@@ &COLOR`GROUP`OOCNAME u(pco)=hx
@@ &COLOR`GROUP`ICDIVIDER u(pco)=c
@@ &COLOR`GROUP`ICEDGE u(pco)=c
@@ &COLOR`GROUP`OOCDIVIDER u(pco)=c
@@ &COLOR`GROUP`OOCEDGE u(pco)=c
@@ &COLOR`GROUP`OOCTAG u(pco)=r
&HLP`GROUPS [u(cobj,group)]=The Group System's comparable to MMORPG guilds.%R%R[ansi(hc,Concepts)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,rank)] - Rank 1 is a group leader\. Rank 2+ are progressively lower in rank. Many commands can be restricted by rank. Staff are considered Rank 0 in all groups.%R[ansi(h,titles)] - titles represent codenames\, aliases\, etc\, or humorous notations\, and display on the group's +gwho and channels.%R[ansi(h,focus)] - Though you can be in many groups\, most commands target the one you have SELECTED via +gfocus.%R[ansi(h,tiers)] - A Group's TIER affects its sorting/display order. These add a sense of hierarchy/importance to groups. Tier 2 is 'better' than Tier 0.%R[ansi(h,Private)] - Groups are 'private' when first created. Only members and staff can 'see' private Groups.)]%R%R[ansi(hc,Basic Commands)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+groups)] - List all public groups.%R[ansi(h,+groups/private)] - Show private groups you have the right to see.%R[ansi(h,+group <group>)] - Show info about a group. Changes FOCUS for group members.%R[ansi(h,+gwho \[<group>\])] - Check online players of the focused group\, or a targeted group.%R[ansi(h,+gfocus <group>)] - Changes group focus if a member.)]
+help/add Community/Groups=[u(cobj,group)]/HLP`GROUPS
&CMD`MYGROUPS [u(cobj,group)]=$+mygroups:@attach %!/INC`MSG=You are a member of: [u(strfirstof,iter(get(%#/D`GROUPS),u(%i0/GET`NAME),%b,\,%b),Nothing!)]
&CMD`+GROUP`PENNMUSH [u(cobj,group)]=$^(?s)(?\:\+)?(groups|group|gwho|gadmin|gmember|gperm|grank|grecall|gtier|gtitle|gfocus|gooc|gic|gradio|gemit)(?\:/(\S+)?)?(?\: +(.+?))?(?\:=(.*))?$:@attach %!/CMD`+GROUP`MAIN
@set [u(cobj,group)]/CMD`+GROUP`PENNMUSH=regexp
&CMD`+GROUP`RHOSTMUSH [u(cobj,group)]=$^(?s)(?\:\+)?(groups|group|gwho|gadmin|gmember|gperm|grank|grecall|gtier|gtitle|gfocus|gooc|gic|gradio|gemit)(?\:/(\\S+)?)?(?\: +(.+?))?(?\:=(.*))?$:@attach %!/CMD`+GROUP`MAIN
@set [u(cobj,group)]/CMD`+GROUP`RHOSTMUSH=regexp
&CMD`+GROUP`MAIN [u(cobj,group)]=th u(setq,systype,grp);@attach %!/INC`CHOOSE=%1,%2,%3,%4
@set [u(cobj,group)]/CMD`+GROUP`[u(choosegame,RHOSTMUSH,PENNMUSH)]=no_command
&CMD`+DIVISION`PENNMUSH [u(cobj,group)]=$^(?s)(?\:\+)?(divisions|division|dmember|dadmin|dperm|drank|dtitle)(?\:/(\S+)?)?(?\: +(.+?))?(?\:=(.*))?$:@attach %!/CMD`+DIVISION`MAIN
@set [u(cobj,group)]/CMD`+DIVISION`PENNMUSH=regexp
&CMD`+DIVISION`RHOSTMUSH [u(cobj,group)]=$^(?s)(?\:\+)?(divisions|division|dmember|dadmin|dperm|drank|dtitle)(?\:/(\\S+)?)?(?\: +(.+?))?(?\:=(.*))?$:@attach %!/CMD`+DIVISION`MAIN
@set [u(cobj,group)]/CMD`+DIVISION`RHOSTMUSH=regexp
&CMD`+DIVISION`MAIN [u(cobj,group)]=th u(setq,systype,div);@attach %!/INC`CHOOSE=%1,%2,%3,%4
@set [u(cobj,group)]/CMD`+DIVISION`[u(choosegame,RHOSTMUSH,PENNMUSH)]=no_command
&SYSTEM`NAME [u(cobj,group)]=GROUP
&SYSTEm`COLORS [u(cobj,group)]=GROUPS
&SYSTEm`OPTIONS [u(cobj,group)]=GROUPS
&SYSTEM`SWITCHES [u(cobj,group)]=setunion(u(SWITCHES`%q<comm>`PLAYER),if(u(isadmin,%#),u(SWITCHES`%q<comm>`ADMIN)),|,|)
&SWITCHES`GADMIN`PLAYER [u(cobj,group)]=CREATE|RENAME|DISBAND|SET|DESC[if(u(cobj,radio),|MAKERADIO|FIXRADIO)]
&SWITCHES`GADMIN`ADMIN [u(cobj,group)]=CONFIG
&SWITCHES`DADMIN`PLAYER [u(cobj,group)]=CREATE|RENAME|DISBAND
&SWITCHES`DADMIN`ADMIN [u(cobj,group)]=
&INC`CHOOSE [u(cobj,group)]=th u(setq,comm,%0);@attach %!/INC`GETSWITCH=%1;@select/inline match(GOOC GIC GRADIO,%q<comm>)=>0,{@attach %!/GRP`GCHANNEL`[u(strfirstof,%q<switch>,MAIN)]=switch(%q<comm>,GOOC,OOC,GIC,IC,GRADIO,OOC),%2,%3},{@attach %!/%q<systype>`%q<comm>`[u(strfirstof,%q<switch>,MAIN)]=%2,%3}
&SWITCHES`GOOC`PLAYER [u(cobj,group)]=GAG|UNGAG|JOIN|LEAVE|RECALL|MUZZLE
&SWITCHES`GIC`PLAYER [u(cobj,group)]=GAG|UNGAG|JOIN|LEAVE|RECALL|MUZZLE
&SWITCHES`GRADIO`PLAYER [u(cobj,group)]=GAG|UNGAG|JOIN|LEAVE|RECALL|MUZZLE
&INC`VALID`GROUPNAME [u(cobj,group)]=@check strlen(u(setr,value,trim(stripansi(%0))))=@attach %!/INC`MSG=ERROR: Group name field empty.;@check valid(name,%q<value>)=@attach %!/INC`MSG=ERROR: Bad name for a group!;@stop u(charsearch,%q<value>,u(badchars))=@attach %!/INC`MSG=ERROR: Bad name for a group! Try without characters: [v(badchars)];@stop cand(isdbref(u(setr,find,u(find_in,u(cobj,gop),%0))),if(isdbref(%1),not(comp(%1,%q<find>))))=@attach %!/INC`MSG=ERROR: A Group already has that name!
&GRP`GADMIN`CONFIG [u(cobj,group)]=@attach %!/INC`CONFIG
&CONFIG`OPTIONS [u(cobj,group)]=OPEN_CREATION|CREATE_PRIVATE|SHOW_UNAPPROVED|IC|OOC
&CONFIG`OPEN_CREATION [u(cobj,group)]=Allow ordinary players to create groups?
&CONFIG`OPEN_CREATION`DEFAULT [u(cobj,group)]=0
&CONFIG`OPEN_CREATION`VALID [u(cobj,group)]=BOOL
&CONFIG`CREATE_PRIVATE [u(cobj,group)]=Are newly-created groups private?
&CONFIG`CREATE_PRIVATE`DEFAULT [u(cobj,group)]=1
&CONFIG`CREATE_PRIVATE`VALID [u(cobj,group)]=BOOL
&CONFIG`SHOW_UNAPPROVED [u(cobj,group)]=Show unapproved characters in Group listings?
&CONFIG`SHOW_UNAPPROVED`DEFAULT [u(cobj,group)]=1
&CONFIG`SHOW_UNAPPROVED`VALID [u(cobj,group)]=BOOL
&CONFIG`IC [u(cobj,group)]=Enable Group IC channels?
&CONFIG`IC`DEFAULT [u(cobj,group)]=1
&CONFIG`IC`VALID [u(cobj,group)]=BOOL
&CONFIG`OOC [u(cobj,group)]=Enable Group OOC channels?
&CONFIG`OOC`DEFAULT [u(cobj,group)]=1
&CONFIG`OOC`VALID [u(cobj,group)]=BOOL
&GRP`GADMIN`CREATE [u(cobj,group)]=@check cor(u(isadmin,%#),u(conf,OPEN_CREATION))=@attach %!/INC`MSG=ERROR: Permission denied. Admin-only command.;@attach %!/GRP`GADMIN`CREATE`DO=%0,1;@attach %!/INC`MSG=You have created the [ansi(hw,%q<g1name>)];@attach %!/INC`CHECKPC=u(strfirstof,if(u(isadmin,%#),%1,%#)),1;@attach %!/GRP`GMEMBER`ADD`DO=%q<g1>,%q<t1objid>,1,{%n added you to the %q<g1name> Group!};@attach %!/INC`MSG=You set %q<t1name> as leader of the %q<g1name>!;@attach %!/INC`MSG`CHAN=Created Group '%q<g1name>'.[if(%q<t1>,%b%q<t1name> is its leader.)];@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Created the Group.[if(isobjid(%q<t1objid>),%B%q<t1name> is its leader.)]};@attach %!/GRP`GFOCUS`MAIN`DO=%q<g1>
&GRP`GADMIN`CREATE`DO [u(cobj,group)]=@attach %!/INC`VALID`GROUPNAME=%0;@check isdbref(u(setr,g%1objid,objid(u(setr,g%1,create(u(setr,g%1name,%q<value>))))))=@attach %!/INC`MSG=ERROR: Group could not be created.;@check u(setr,g%1id,u(call`4,volp_group,0,'[sqlescape(r(g%1objid))]','[sqlescape(r(g%1name))]',0,u(conf,CREATE_PRIVATE)))={@attach %!/INC`MSG=ERROR: Group Could not be Created. Reason: [r(g%1id)];@attach %!/DELETE=r(g%1)};@tel [r(g%1)]=[u(cobj,gop)];@parent [r(g%1)]=[u(cobj,gop)];@power [r(g%1)]=many_attribs;@set [r(g%1)]=[u(choosegame,WIZARD SAFE,INHERIT SAFE)];th u(attrib_set,r(g%1),D`ID,r(g%1id));@dolist/inline/delimit | 1~Leader|2~Second|3~Officer|4~Member={@attach %!/GRP`GRANK`CREATE`DO=r(g%1objid),before(##,~),after(##,~)}
&INC`VALID`TIER [u(cobj,group)]=@check strlen(u(setr,tiernum,trim(before(%0,.))))=@attach %!/INC`MSG=ERROR: No Tier numbered entered!;@check cand(isint(%q<tiernum>),gte(%q<tiernum>,0),lte(%q<tiernum>,255))=@attach %!/INC`MSG=Tiers must be a whole number between 0 and 255.
&INC`VALID`TIERNAME [u(cobj,group)]=@check strlen(u(setr,tiername,trim(stripansi(%0))))=@attach %!/INC`MSG=ERROR: No Tier Name entered!;@check cand(isint(%q<tiernum>),gte(%q<tiernum>,0),lte(%q<tiernum>,255))=@attach %!/INC`MSG=Tiers must be a whole number between 0 and 255.
&SWITCHES`GTIER`ADMIN [u(cobj,group)]=RENAME|PRIVATE|RENAMEPRIVATE
&GRP`GTIER`MAIN [u(cobj,group)]=@select/inline t(%0)=>0,{@attach %!/GRP`GTIER`RENAME},{@attach %!/GRP`GTIER`LIST}
&GRP`GTIER`PRIVATE [u(cobj,group)]=@attach %!/GRP`GTIER`LIST=,,1
&GRP`GTIER`LIST [u(cobj,group)]=@pemit %#=u(header,mudname() Group [if(%2,Private%b)]Tiers);@pemit %#=u(separator);@pemit %#=ansi(u(color,%#,GROUPS,COLUMN_NAMES),align(5 10 60,Tier,Name,Groups));@pemit %#=u(separator);@dolist/inline/delimit [u(rsep)] [u(mysql3,SELECT`TIERS,t(%2))]={th u(setq,data,u(choosegame,%i0,%d0));@pemit %#=align(5 10 60,u(elements,%q<data>,1,u(fsep)),u(elements,%q<data>,2,u(fsep)),iter(u(elements,%q<data>,3,u(fsep)),u(%i0/GET`NAME),%b,\,%b));@pemit %#=u(separator)};@pemit %#=u(footer)
&Q`SELECT`TIERS [u(cobj,group)]=SELECT group_tier,tier_name,group_objids FROM volv_group_tiers WHERE group_parent IS NULL and group_is_private=?
&GRP`GTIER`RENAMEPRIVATE [u(cobj,group)]=@attach %!/GRP`GTIER`RENAME=%0,%1,1
&GRP`GTIER`RENAME [u(cobj,group)]=@check u(iswizard,%#)=@attach %!/INC`MSG=ERROR: Wizard Only.;@attach %!/INC`VALID`TIER=%0;@attach %!/INC`VALID`TIERNAME=%1;@attach %!/INC`DOSQL=NAME`TIER,%q<tiernum>,t(%2),%q<tiername>;@attach %!/INC`MSG=[if(%2,Private%b)]Tier %q<tiernum> is now known as: %q<tiername>.;@attach %!/INC`MSG`CHAN=[if(%2,PRIVATE%b)]GROUP TIER %q<tiernum> is now known as: %q<tiername>.
&Q`NAME`TIER [u(cobj,group)]=INSERT INTO vol_group_tier(group_tier,group_is_private,tier_name) VALUES (?,?,?) ON DUPLICATE KEY UPDATE tier_name=VALUES(tier_name)
&INC`VALID`DIVISIONNAME [u(cobj,group)]=@check strlen(u(setr,value,trim(stripansi(%0))))=@attach %!/INC`MSG=ERROR: Division name field empty.;@check valid(name,%q<value>)=@attach %!/INC`MSG=ERROR: Bad name for a Division!;@stop u(charsearch,%q<value>,u(badchars) /)=@attach %!/INC`MSG=ERROR: Bad name for a Division! Try without characters: [v(badchars)] /;@stop cand(isdbref(u(setr,find,u(find_in,%1,%0))),if(isdbref(%2),not(comp(%2,%q<find>))))=@attach %!/INC`MSG=ERROR: A Division already has that name!
&DIV`DADMIN`CREATE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/DIV`DADMIN`CREATE`DO=%0,%q<g1>;@select/inline [t(strlen(%1))][isdbref(pmatch(%1))]=11,{@attach %!/INC`CHECKPC=%1,1;@attach %!/DIV`DMEMBER`ADD`DO=%q<g1>,%q<t1objid>,%q<d1id>,1,{%n added you to the %q<g1name>'s new Division: %q<value>};@attach %!/INC`MSG=You set %q<t1name> as leader of the %q<g1name>'s new Division: %q<value>!},10,{@attach %!/INC`MSG=The Division was created\, but '%1' does not match a player!},0*,{@attach %!/INC`MSG=The Division '%q<value>' was created.};@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Created the Division '%q<value>'.[if(isobjid(%q<t1objid>),%B%q<t1name> is its leader.)]}
&DIV`DADMIN`CREATE`DO [u(cobj,group)]=@attach %!/INC`VALID`DIVISIONNAME=%0,%1;@check u(setr,d1objid,objid(u(setr,d1,create(u(setr,d1name,%q<value>)))))=@attach %!/INC`MSG=ERROR: Division could not be created. Could not create THING object.;@check u(setr,d1id,u(call`3,volp_group_division,0,'%q<d1objid>','[sqlescape(%q<d1name>)]',get(%1/D`ID)))={@attach %!/INC`MSG=ERROR: Division could not be created. Reason: %q<d1id>;@attach %!/DELETE=%q<d1>};th u(attrib_set,%q<d1>,D`ID,%q<d1id>);th u(attrib_set,%1,DIVISIONS,u(sortname,u(filter,ISOBJID,setunion(get(%1/DIVISIONS),%q<d1objid>))));@parent %q<d1>=u(cobj,dop);@tel %q<d1>=%1;@power %q<d1>=many_attribs;@set %q<d1>=[u(choosegame,WIZARD SAFE,INHERIT SAFE)];@dolist/inline/delimit | 1~Leader|2~Second|3~Officer|4~Member={@attach %!/GRP`GRANK`CREATE`DO=%q<d1>,before(##,~),after(##,~)}
@@ Arg %0 - Division Name. %1 - Division Parent DBREF.
&FUN`FINDGROUP [u(cobj,group)]=u(namegrab,if(%2,get(%2/DIVISIONS),u(FUN`LISTGROUPS,%1)),%0)
&FUN`LISTGROUPS [u(cobj,group)]=if(strlen(%0),u(filter,PRIVATE,u(sortname,children(u(cobj,gop))),%b,%b,objid(%0)),u(sortname,children(u(cobj,gop))))
&FIL`PRIVATE [u(cobj,group)]=if(get(%0/SET`PRIVATE),cor(u(isadmin,%1),match(get(%0/INVITES),%1),match(get(%0/MEMBERS),%1)),1)
&INC`FINDGROUP [u(cobj,group)]=@attach %!/INC`VALID`GROUP=%0;@attach %!/INC`LOADGROUP=%q<value>,%1;
&INC`LOADGROUP [u(cobj,group)]=th u(setq,g%1name,name(u(setr,g%1objid,objid(u(setr,g%1,num(%0))))));th u(setq,g%1id,get(%0/D`ID))
&GRP`GFOCUS`MAIN [u(cobj,group)]=@check strlen(%0)=@attach %!/INC`MSG=ERROR: Must enter a Group name!;@check isdbref(u(setr,g1,u(namegrab,u(filter,CANFOCUS,u(FUN`LISTGROUPS,%:),%b,%b,%:),%0)))=@attach %!/INC`MSG=ERROR: Sorry. '%0' did not match anything.;@attach %!/GRP`GFOCUS`MAIN`DO=%q<g1>
&GRP`GFOCUS`MAIN`DO [u(cobj,group)]=@attach %!/INC`LOADGROUP=%0,1;th u(attrib_set,%#,D`GROUP,%q<g1objid>);@attach %!/INC`MSG=Changed to Managing the [u(%q<g1>/GET`NAME)].
&FIL`CANFOCUS [u(cobj,group)]=cor(u(isadmin,%1),match(get(%0/MEMBERS),%1),t(words(get(%1/D`GROUP`[num(%0)]`GRANTED))))
@@ &INC`CODE`MAKELOG [u(cobj,group)]=th u(attrib_set,%1,u(setr,log,LOG`[u(nextslot,%1,LOG)]),%2);&%q<log>`SUBMITTER %1=%0;&%q<log>`SUBMITTED %1=secs()
&INC`TARGET [u(cobj,group)]=@check isobjid(get(%#/D`GROUP))=@attach %!/INC`MSG=ERROR: No group focused! Use +gfocus <groupname> to pick a group.;@attach %!/INC`LOADGROUP=get(%#/D`GROUP),1
&GRP`GADMIN`RENAME [u(cobj,group)]=@attach %!/INC`FINDGROUP=%0,1;@check u(FUN`GRPPERM,%:,%q<g1>,RENAME)=@attach %!/INC`MSG=ERROR: Permission Denied.;@attach %!/INC`VALID`GROUPNAME=%1,%q<g1>;@attach %!/GRP`GADMIN`RENAME`DO=%q<g1>,%q<value>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Group Renamed to: %q<value>};@attach %!/INC`CODE`CHAT={%n Renamed the Group to %q<value>},OOC,1
&GRP`GADMIN`RENAME`DO [u(cobj,group)]=@attach %!/INC`DOSQL=RENAME`GROUP,%1,get(%0/D`ID);@name %0=%1
&Q`RENAME`GROUP [u(cobj,group)]=UPDATE vol_entity SET entity_name=? WHERE entity_id=?
&GRP`GADMIN`DESC [u(cobj,group)]=@attach %!/INC`FINDGROUP=%0,1;@check u(FUN`GRPPERM,%:,%q<g1>,DESCRIBE)=@attach %!/INC`MSG=ERROR: Permission Denied.;@check strlen(%1)=@attach %!/INC`MSG=ERROR: Nothing entered for the description!;@attach %!/GRP`GADMIN`DESC`DO=%q<g1>,%1;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Group redesced to: %1};@attach %!/INC`CODE`CHAT={%n described the group: %0%1},OOC,1
&GRP`GADMIN`DESC`DO [u(cobj,group)]=@attach %!/INC`DOSQL=DESC`GROUP,%1,get(%0/D`ID);@describe %0=%1
&Q`DESC`GROUP [u(cobj,group)]=UPDATE vol_group SET group_description=? WHERE group_id=?
&FUN`FINDDIV [u(cobj,group)]=u(FUN`FINDGROUP,%0,,%1)
&INC`FINDDIV [u(cobj,group)]=@check strlen(%0)=@attach %!/INC`MSG=ERROR: No Division name entered!;@check isobjid(u(setr,div,u(FUN`FINDDIV,%0,%q<g1>)))=@attach %!/INC`MSG=ERROR: Division '%0' not found.;@attach %!/INC`LOADDIV=%q<div>,1
&INC`LOADDIV [u(cobj,group)]=th u(setq,d%1name,name(u(setr,d%1objid,objid(u(setr,d%1,%0)))));th u(setq,d%1id,get(%0/D`ID))
&DIV`DADMIN`RENAME [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission Denied.;@attach %!/INC`FINDDIV=%0;@attach %!/INC`VALID`DIVISIONNAME=%1,%q<g1>,%q<d1>;@attach %!/GRP`GADMIN`RENAME`DO=%q<d1>,%q<value>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Division '%q<d1name>' renamed to: %q<value>};@attach %!/INC`CODE`CHAT={%n Renamed '%q<d1name>' Division to %q<value>},OOC,1
&GRP`GADMIN`DISBAND [u(cobj,group)]=@check u(iswizard,%#)=@attach %!/INC`MSG=ERROR: Sorry! Wizard only.;@attach %!/INC`FINDGROUP=%0,1;@check strmatch(%1,%q<g1name>)=@attach %!/INC`MSG=ERROR: Must enter the group's full name as the second argument to verify.;@attach %!/INC`VERIFY=[ansi(hr,WARNING:)] This will DELETE Group '%q<g1name>'. This is not recommended for well-established groups. If you're sure\, enter the command again in ten seconds to verify.,DELETE GROUP %q<g1>;@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n has Disbanded the Group!},OOC,1;@attach %!/INC`MSG`CHAN=DISBANDED Group '%q<g1name>';@attach %!/GRP`GADMIn`DISBAND`DO=%q<g1>
&GRP`GADMIN`DISBAND`DO [u(cobj,group)]=@attach %!/INC`DOSQL=DELETE`GROUP,get(%0/D`ID);@dolist/inline get(%0/MEMBERS)={@trigger %!/GRP`CACHE`CHARACTER=##;@trigger %!/GRP`CACHE`TIERS=##};@attach %!/INC`DOSQL=DELETE`GROUPCHAT,objid(%0);@attach %!/DELETE=%0
&Q`DELETE`GROUP [u(cobj,group)]=DELETE FROM vol_entity WHERE entity_id=?
&Q`DELETE`GROUPCHAT [u(cobj,group)]=DELETE from vol_messages WHERE source_objid=?
&PLAYER`DISCONNECT [u(cobj,group)]=@stop %1;@attach %!/WIPE=%0,D`GROUP`#*`GAG
&DIV`DADMIN`DISBAND [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`FINDDIV=%0;@check strmatch(%1,%q<d1name>)=@attach %!/INC`MSG=ERROR: Must enter the Division's full name as the second argument to verify.;@attach %!/INC`VERIFY=[ansi(hr,WARNING:)] This will DELETE Division '%q<d1name>'. If you're sure\, enter the command again in ten seconds to verify.,DELETE DIV %q<g1> %q<d1id>;@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n has Disbanded the '%q<d1name>' Division!},OOC,1;@attach %!/INC`MSG`CHAN=DISBANDED Group '%q<g1name>' Division '%q<d1name>';@attach %!/DIV`DADMIn`DISBAND`DO=%q<g1>,%q<d1>
&DIV`DADMIN`DISBAND`DO [u(cobj,group)]=th u(attrib_set,%0,DIVISIONS,u(sortname,u(filter,ISOBJID,setdiff(get(%0/DIVISIONS),objid(%1)))));@attach %!/GRP`GADMIN`DISBAND`DO=%1
&ADMIN`PLAYER [u(cobj,group)]=COLOR|STARTRANK|IC|OOC|COMMAND|CHANNELRANK|SYSALERT
&ADMIN`ADMIN [u(cobj,group)]=PRIVATE|SECRETIVE|TIER|DISPLAYMODE|ABBREVIATION|LETTER|CHANNELS|NOREPORT|RADIOS
&GRP`GADMIN`LIST [u(cobj,group)]=@pemit %#=u(header,%q<g1name> - Settings);@dolist/inline u(lattrp,%q<g1>/SET`*)={@pemit %#=rjust(last(##,`),10): [get(%q<g1>/##)]};@pemit %#=u(footer)
&GRP`GADMIN`MAIN [u(cobj,group)]=@attach %!/INC`TARGET;@select/inline strlen(%0)=0,{@attach %!/GRP`GADMIN`LIST},{@attach %!/GRP`GADMIN`SET}
&GRP`GADMIN`SET [u(cobj,group)]=@attach %!/INC`TARGET;@select/inline strlen(%0)=>0,{@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@check cor(u(isadmin,%#),lte(get(%#/D`GROUP`%q<g1>`RANK),1))=@attach %!/INC`MSG=ERROR: You lack permission to do that.;@attach %!/INC`PARTIAL=%0,u(setr,choices,setunion(v(ADMIN`PLAYER),if(u(isadmin,%#),v(ADMIN`ADMIN)),|,|)),|,option;@attach %!/GRP`GADMIN`SET`%q<option>;@attach %!/GRP`GADMIN`SET`FINISH},{@attach %!/GRP`GADMIN`SET`VIEW}
&GRP`GADMIN`SET`VIEW [u(cobj,group)]=@pemit %#=u(header,%q<g1name> - Settings);@dolist/inline COLOR STARTRANK IC OOC NOREPORT TIER PRIVATE ABBREVIATION LETTER DISPLAYMODE SYSALERT COMMAND CHANNELS RADIOS={@pemit %#=u(separator,##);@pemit %#=align(10 10 12 40,rjust(ansi(hw,TYPE:),10),get(%q<g1>/SET`##`TYPE),ansi(hw,DESCRIPTION:),get(%q<g1>/SET`##`DESC));@pemit %#=[rjust(ansi(hw,DEFAULT:),10)]%b[get(u(cobj,gop)/SET`##)];@pemit %#=[rjust(ansi(hw,CURRENT:),10)]%b[get(%q<g1>/SET`##)]};@pemit %#=u(footer)
&GRP`GADMIN`SET`COLOR [u(cobj,group)]=@attach %!/INC`VALID`COLOR=%1;&SET`COLOR %q<g1>=%q<value>
&GRP`GADMIN`SET`STARTRANK [u(cobj,group)]=@attach %!/INC`VALID`POSINT=%1,STARTRANK;@stop lte(%q<value>,2)=@attach %!/INC`MSG=ERROR: STARTRANK may not be higher than 3.;@stop lte(%q<value>,u(FUN`GETRANK,%q<g1>,%:))=@attach %!/INC`MSG=ERROR: Cannot raise STARTRANK beyond your own rank.;@check hasattrp(%q<g1>/RANK`%q<value>)=@attach %!/INC`MSG=ERROR: Cannot find that rank.;&SET`STARTRANK %q<g1>=%q<value>
&GRP`GADMIN`SET`SECRETIVE [u(cobj,group)]=@attach %!/INC`VALID`BOOL=%1,SECRETIVE;&SET`SECRETIVE %q<g1>=%q<value>
&GRP`GADMIN`SET`RADIOS [u(cobj,group)]=@attach %!/INC`VALID`RADIOLIST=%1;&SET`%q<option> %q<g1>=%q<value>
&GRP`GADMIN`SET`IC [u(cobj,group)]=@attach %!/GRP`GADMIN`SET`OOC;
&GRP`GADMIN`SET`CHANNELRANK [u(cobj,group)]=@attach %!/GRP`GADMIN`SET`OOC;
&GRP`GADMIN`SET`NOREPORT [u(cobj,group)]=@attach %!/GRP`GADMIN`SET`OOC;
&GRP`GADMIN`SET`PRIVATE [u(cobj,group)]=@attach %!/GRP`GADMIN`SET`OOC;@attach %!/INC`DOSQL=SET`PRIVATE,%q<value>,get(%q<g1>/D`ID);@dolist/inline get(%q<g1>/MEMBERS)={@attach %!/GRP`CACHE`TIERS=##}
&GRP`GADMIN`SET`OOC [u(cobj,group)]=@attach %!/INC`VALID`BOOL=%1,%q<option>;&SET`%q<option> %q<g1>=%q<value>
&GRP`GADMIN`SET`COMMAND [u(cobj,group)]=@attach %!/INC`VALID`POSINT=%1,%q<option>;&SET`%q<option> %q<g1>=%q<value>;@attach %!/GRP`CACHE`MEMBERS=%q<g1>
&GRP`GADMIN`SET`SYSALERT [u(cobj,group)]=@attach %!/INC`VALID`POSINT=%1,%q<option>;&SET`%q<option> %q<g1>=%q<value>
&GRP`GADMIN`SET`DISPLAYMODE [u(cobj,group)]=@attach %!/INC`PARTIAL=%1,STANDARD|DIVISIONAL,|,value;&SET`%q<option> %q<g1>=%q<value>
&GRP`GADMIN`SET`ABBREVIATION [u(cobj,group)]=@check strlen(%1)=@attach %!/INC`MSG=ERROR: %q<option> must have content!;&SET`ABBREVIATION %q<g1>=u(setr,value,%1);@attach %!/INC`DOSQL=SET`ABBREVIATION,%q<value>,get(%q<g1>/D`ID)
&Q`SET`ABBREVIATION [u(cobj,group)]=UPDATE vol_group SET group_abbr=? WHERE group_id=?
&Q`SET`PRIVATE [u(cobj,group)]=UPDATE vol_group SET group_is_private=? WHERE group_id=?
&GRP`GADMIN`SET`LETTER [u(cobj,group)]=@check strlen(%1)=@attach %!/INC`MSG=ERROR: %q<option> must have content!;&SET`LETTER %q<g1>=u(setr,value,%1)
&GRP`GADMIN`SET`CHANNELS [u(cobj,group)]=@check strlen(%1)=@attach %!/INC`MSG=ERROR: %q<option> must have content!;&SET`CHANNELS %q<g1>=u(setr,value,%1)
&GRP`GADMIN`SET`TIER [u(cobj,group)]=@check cand(isint(u(setr,value,%1)),gte(%q<value>,0))=@attach %!/INC`MSG=ERROR: %q<option> must be a positive integer 0 or greater.;&SET`%q<option> %q<g1>=%q<value>;@attach %!/INC`DOSQL=SET`TIER,%q<value>,%q<g1id>;@dolist/inline get(%q<g1>/MEMBERS)={@attach %!/GRP`CACHE`TIERS=##}
&Q`SET`TIER [u(cobj,group)]=UPDATE vol_group SET group_tier=? WHERE group_id=?
&GRP`GADMIN`SET`FINISH [u(cobj,group)]=@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Setting %q<option>: %q<value>};@attach %!/INC`MSG=You have changed %q<g1name>'s %q<option> Setting to: %q<value>;@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n changed %q<option> Setting to: %q<value>},OOC,1
&GRP`GADMIN`MAKERADIO [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied. Do not have Manage Permission.;@attach [u(Cobj,radio)]/INC`VALID`RADIONAME=%0;@stop isdbref(u(u(cobj,radio)/FUN`FINDFREQ,%q<value>))=@attach %!/INC`MSG=ERROR: A radio channel of that name already exists.;@tel u(setr,freq,create(%q<value>))=u(cobj,freq);@parent %q<freq>=u(cobj,freq);&OWNER %q<freq>=%:;@attach %!/GRP`GADMIN`FIXRADIO`DO=%q<g1>,%q<freq>;@attach %!/INC`MSG=Radio channel '%0' created.;@attach %!/INC`MSG`CHAN=Group Radio channel '%0' created.;@trigger [u(cobj,radio)]/INC`JOIn`DO=%#,%q<freq>,%1
&GRP`GADMIN`FIXRADIO [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`VALID`RADIO=%0;@check u(u(cobj,radio)/FUN`PERMISSION,u(setr,freq,%q<value>),ADMIN,%:)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/GRP`GADMIn`FIXRADIO`DO=%q<g1>,%q<value>;@attach %!/INC`MSG=Radio channel '%q<valueformat>' reset to %q<g1name>.;@attach %!/INC`MSG`CHAN=Radio channel '%q<valueformat>' reset to %q<g1name>.
&GRP`GADMIN`FIXRADIO`DO [u(cobj,group)]=&GROUP %1=objid(%0);&SEE_LOCK %1=u(group_lock,%0|%0/RADIO);&JOIN_LOCK %1=get(%1/SEE_LOCK);&SPEAK_LOCK %1=get(%1/SEE_LOCK);&MODERATE_LOCK %1=u(group_lock,%0/MODERATE);&ADMIN_LOCK %1=u(group_lock,%0/MANAGE);&SET`RADIOS %0=u(filter,ISOBJID,setunion(get(%0/SET`RADIOS),objid(%1)))
&HLP`ADMIN [u(cobj,group)]=[ansi(hc,Administration Commands)]%RTier management is admin only. Creation, Renaming, and Disbanding are admin-only unless opened via +gadmin/config.%R%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gtier)] - Display All Tiers. +gtier/private for private Tiers.%R[ansi(h,+gtier/rename <tier#>=<newname>)] - Give a name to a tier. /renameprivate for Private Tiers.%R[ansi(h,+gadmin/create <groupname>\[=<player>\])] - This command creates a new Group and grants leadership to <player> if provided.%R[ansi(h,+gadmin/rename <group>=<newname>)] - Renames a Group.%R[ansi(h,+gadmin/desc <group>=<description)] - Set a group's description.%R[ansi(h,+gadmin/disband <groupname>=<groupname>)] - Must be focused to the group AND typing its name. in both fields. Extra verification power!%R[ansi(h,+gadmin/config)] - Access the Group global Config system. <option>=<value> to change it!%R[ansi(h,+gadmin/set)] - Access the per-Group settings. Again\, <option>=<value> to change them!)]
+help/addsub Groups/Admin=[u(cobj,group)]/HLP`ADMIN
&STARTUP [u(Cobj,group)]=@trigger %!/LOOP`CLEANUPGROUPCHAT
&LOOP`CLEANUPGROUPCHAT [u(Cobj,group)]=@dolist children(u(cobj,gop))={@attach %!/INC`DOSQL=CLEANUp`GROUPCHAT,1,objid(##),1,objid(##);@attach %!/INC`DOSQL=CLEANUP`GROUPCHAT,2,objid(##),2,objid(##)};@wait mul(60,60,2)=@trigger %!/LOOP`CLEANUPGROUPCHAT
&Q`CLEANUP`GROUPCHAT [u(Cobj,group)]=DELETE m FROM vol_messages AS m LEFT JOIN (SELECT message_id FROM vol_messages as msg WHERE msg.message_type=? AND msg.source_objid=? ORDER BY msg.message_date_created DESC LIMIT 100) AS m2 ON m.message_id=m2.message_id WHERE m.message_type=? AND m.source_objid=? AND m2.message_id IS NULL
@@ RANK SECTION
&SWITCHES`GRANK`PLAYER [u(cobj,group)]=CREATE|DELETE|RENAME
&SWITCHES`DRANK`PLAYER [u(cobj,group)]=CREATE|DELETE|RENAME
&FUN`GETRANK [u(cobj,group)]=if(u(isadmin,%1),0,get(%1/D`GROUP`[num(%0)]`RANK))
&INC`VALID`RANKNUMBER [u(cobj,group)]=@check strlen(u(setr,rnkvalue,abs(trim(%0))))=@attach %!/INC`MSG=ERROR: Rank value field empty.;@check u(valnum,%q<rnkvalue>)=@attach %!/INC`MSG=ERROR: Ranks must be whole positive integers.
&INC`VALID`RANKNAME [u(cobj,group)]=@check strlen(u(setr,rnkname,trim(%0)))=@attach %!/INC`MSG=ERROR: Rank name field empty.;@stop u(charsearch,%q<rnkname>,u(badchars))=@attach %!/INC`MSG=ERROR: Rank names may not contain: [v(badchars)];@dolist/inline u(lattr,%1/%2`*)={@stop cand(strmatch(get(%1/##`NAME),%q<rnkname>),neq(last(##,`),%3))=@attach %!/INC`MSG=ERROR: This Rank Name is already in use!}
&GRP`GRANK`CREATE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`VALID`RANKNUMBER=%0;@check gte(%q<rnkvalue>,u(FUN`GETRANK,%q<g1>,%:))=@attach %!/INC`MSG=ERROR: Cannot create ranks greater than your own.;@stop hasattr(%q<g1>/RANK`%q<rnkvalue>)=@attach %!/INC`MSG=ERROR: Rank already exists! Use +grank/rename to rename it.;@attach %!/INC`VALID`RANKNAME=%1,%q<g1>,RANK;@attach %!/GRP`GRANK`CREATE`DO=%q<g1>,%q<rnkvalue>,%q<rnkname>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Created Rank %q<rnkvalue>: %q<rnkname>};@attach %!/INC`CODE`CHAT={Created Rank %q<rnkvalue>: %q<rnkname>},OOC,1
&GRP`GRANK`CREATE`DO [u(cobj,group)]=@check u(setr,rank_id,u(call`3,volp_group_rank,0,get(%0/D`ID),%1,'[sqlescape(%2)]'))=@attach %!/INC`MSG=ERROR: Rank could not be created! Reason: %q<rank_id>;th u(attrib_set,%0,RANK`%1,%q<rank_id>);th u(attrib_set,%0,RANK`%1`NAME,%2)
&GRP`GRANK`DELETE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`VALID`RANKNUMBER=%0;@check gte(%q<rnkvalue>,u(FUN`GETRANK,%q<g1>,%:))=@attach %!/INC`MSG=ERROR: Cannot Delete ranks greater than your own.;@stop get(%q<g1>/RANK`%q<rnkvalue>`NODELETE)=@attach %!/INC`MSG=ERROR: Cannot Delete default ranks.;@stop eq(%q<rnkvalue>,get(%0/SET`STARTRANK))=@attach %!/INC`MSG=ERROR: Cannot Delete the group's Starting Rank! Change it first with +gadmin/set.;@check hasattr(%q<g1>/RANK`%q<rnkvalue>)=@attach %!/INC`MSG=ERROR: Rank not found!;@stop words(get(%q<g1>/MEMBERS`%q<rnkvalue>))=@attach %!/INC`MSG=ERROR: Rank has members. They must be removed or given different ranks before proceeding.;th u(setq,rnkname,get(%q<g1>/RANK`%q<rnkvalue>`NAME));@attach %!/GRP`GRANK`DELETE`DO=%q<g1>,%q<rnkvalue>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Deleted Rank %q<rnkvalue>: %q<rnkname>};@attach %!/INC`CODE`CHAT={Deleted Rank %q<rnkvalue>: %q<rnkname>},OOC,1
&GRP`GRANK`DELETE`DO [u(cobj,group)]=@attach %!/INC`DOSQL=DELETE`RANK,get(%0/RANK`%1);@attach %!/WIPE=%0,RANK`%1
&Q`DELETE`RANK [u(cobj,group)]=DELETE FROM vol_group_rank WHERE rank_id=?
&DIV`DRANK`CREATE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`FINDDIV=before(%0,/);@attach %!/INC`VALID`RANKNUMBER=after(%0,/);@stop hasattr(%q<d1>/RANK`%q<rnkvalue>)=@attach %!/INC`MSG=ERROR: Rank already exists! Use +drank/rename to rename it.;@attach %!/INC`VALID`RANKNAME=%1,%q<d1>,RANK;@attach %!/GRP`GRANK`CREATE`DO=%q<d1>,%q<rnkvalue>,%q<rnkname>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Created Division '%q<d1name>' Rank %q<rnkvalue>: %q<rnkname>};@attach %!/INC`CODE`CHAT={Created Division '%q<d1name>' Rank %q<rnkvalue>: %q<rnkname>},OOC,1
&DIV`DRANK`DELETE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`FINDDIV=before(%0,/);@attach %!/INC`VALID`RANKNUMBER=after(%0,/);@check hasattr(%q<d1>/RANK`%q<rnkvalue>)=@attach %!/INC`MSG=ERROR: Rank does not exist!;th u(setq,rnkname,get(%q<d1>/RANK`%q<rnkvalue>`NAME));@attach %!/GRP`GRANK`DELETE`DO=%q<d1>,%q<rnkvalue>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Deleted Division '%q<d1name>' Rank %q<rnkvalue>: %q<rnkname>};@attach %!/INC`CODE`CHAT={Deleted Division '%q<d1name>' Rank %q<rnkvalue>: %q<rnkname>},OOC,1
&GRP`GRANK`RENAME [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`VALID`RANKNUMBER=%0;@check gte(%q<rnkvalue>,u(FUN`GETRANK,%q<g1>,%:))=@attach %!/INC`MSG=ERROR: Cannot Rename ranks greater than your own.;@check hasattr(%q<g1>/RANK`%q<rnkvalue>)=@attach %!/INC`MSG=ERROR: Rank not found!;@attach %!/INC`VALID`RANKNAME=%1,%q<g1>,RANK,%q<rnkvalue>;th u(setq,oldrnkname,get(%q<g1>/RANK`%q<rnkvalue>`NAME));@attach %!/GRP`GRANK`RENAME`DO=%q<g1>,%q<rnkvalue>,%q<rnkname>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Renamed Rank %q<rnkvalue>: %q<oldrnkname> to: %q<rnkname>};@attach %!/INC`CODE`CHAT={Renamed Rank %q<rnkvalue>: %q<oldrnkname> to: %q<rnkname>},OOC,1
&GRP`GRANK`RENAME`DO [u(cobj,group)]=@attach %!/INC`DOSQL=RENAME`RANK,%2,get(%0/RANK`%1);th u(attrib_set,%0,RANK`%1`NAME,%2)
&Q`RENAME`RANK [u(cobj,group)]=UPDATE vol_entity SET entity_name=? WHERE entity_id=?
&DIV`DRANK`RENAME [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`FINDDIV=before(%0,/);@attach %!/INC`VALID`RANKNUMBER=after(%0,/);@check hasattr(%q<d1>/RANK`%q<rnkvalue>)=@attach %!/INC`MSG=ERROR: Rank does not exist!;th u(setq,oldrnkname,get(%q<d1>/RANK`%q<rnkvalue>`NAME));@attach %!/INC`VALID`RANKNAME=%1,%q<d1>,RANK,%q<rnkvalue>;@attach %!/GRP`GRANK`RENAME`DO=%q<d1>,%q<rnkvalue>,%q<rnkname>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Renamed Division '%q<d1name>' Rank %q<rnkvalue>: %q<oldrnkname> to: %q<rnkname>};@attach %!/INC`CODE`CHAT={Renamed Division '%q<d1name>' Rank %q<rnkvalue>: %q<oldrnkname> to: %q<rnkname>},OOC,1
&GRP`GRANK`MAIN [u(cobj,group)]=@select/inline strlen(%0)=0,{@attach %!/INC`TARGET},{@attach %!/INC`FINDGROUP=%0,1};@pemit %#=u(header,u(%q<g1>/GET`NAME): Ranks);@attach %!/GRP`GRANK`MAIN`DO=%q<g1>,u(sortattr,setdiff(u(lattrp,%q<g1>/RANK`*),RANK`ALL)) RANK`ALL
&GRP`GRANK`MAIN`DO [u(cobj,group)]=@pemit %#=ansi(u(color,%#,GROUPS,COLUMN_NAMES),align(5 28 [sub(u(width,%#),35)],#,Name,Permissions));@pemit %#=u(separator);@dolist/inline %1={@pemit %#=u(FUN`RANKDISPLAY,%0,##)};@pemit %#=u(FOOTER)
&FUN`RANKDISPLAY [u(cobj,group)]=align(5 28 [sub(u(width,%#),35)],last(%1,`),get(%0/%1`NAME),lcstr(get(%0/%1`PERM)))
&DIV`DRANK`MAIN [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`FINDDIV=%0;@pemit %#=u(header,u(%q<g1>/GET`NAME): '%q<d1name>' Division Ranks);@attach %!/GRP`GRANK`MAIN`DO=%q<d1>,u(sortattr,setdiff(u(lattrp,%q<d1>/RANK`*),RANK`ALL)) RANK`ALL
&GRP`GRANK`NUMBER [u(Cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`VALID`RANKNUMBER=%0;@check gte(%q<rnkvalue>,u(FUN`GETRANK,%q<g1>,%:))=@attach %!/INC`MSG=ERROR: Cannot Re-number ranks greater than your own.;@check hasattr(%q<g1>/RANK`%q<rnkvalue>)=@attach %!/INC`MSG=ERROR: Rank not found!;@attach %!/INC`VALID`INT=%1;@check gte(%q<value>,u(FUN`GETRANK,%q<g1>,%:))=@attach %!/INC`MSG=ERROR: Cannot create ranks better than your own.;@stop hasattr(%q<g1>/RANK`%q<value>)=@attach %!/INC`MSG=ERROR: Rank Number is already in use.;
&GRP`GRANK`NUMBER`DO [u(cobj,group)]=@check u(setr,rank_id,u(call`3,volp_group_rank,0,get(%0/D`ID),%1,'[sqlescape(%2)]'))=@attach %!/INC`MSG=ERROR: Rank could not be created! Reason: %q<rank_id>;th u(attrib_set,%0,RANK`%1,%q<rank_id>);th u(attrib_set,%0,RANK`%1`NAME,%2)
&HLP`RANKS [u(cobj,group)]=[ansi(hc,Leader Commands)]%ROnly the group leader is allowed to alter the rank structure and associated permissions.%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+grank/create <#>=<rankname>)] - Create a new rank.%R[ansi(h,+grank/delete <#>)] - Remove a rank\, if no players are in it.%R[ansi(h,+grank/rename <#>=<newname>)] - Renames a rank.)]%R%R[ansi(hc,Member Commands)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+grank)] - Display rank structure and permissions granted.)]
+help/addsub Groups/Ranks=[u(cobj,group)]/HLP`RANKS
@@ Permissions Section
&SWITCHES`GPERM`PLAYER [u(cobj,group)]=CREATE|DELETE|GRANT|REVOKE
&FUN`GRPPERM [u(cobj,group)]=cor(u(isadmin,%0),match(get(%0/V`GROUP`[get(%1/D`ID)]`PERMISSIONS),%2))
&FUN`GETPERM [u(cobj,group)]=localize(setunion(get(%1/D`GROUP`[num(%0)]`GRANTED),if(u(setr,rnkval,get(%1/D`GROUP`[num(%0)]`RANK)),setunion(get(%0/RANK`ALL`PERM),get(%0/RANK`%q<rnkval>`PERM)))))
&FUN`PERMS [u(cobj,group)]=setunion(setunion(v(PERMISSIONS`PLAYER),if(cor(u(isadmin,%#),%1),v(PERMISSIONS`ADMIN)),|,|),get(%0/PERMCUST),|,|)
&PERMISSIONS`PLAYER [u(cobj,group)]=MODERATE|MANAGE|IC|OOC|BBADMIN|GEMIT|TITLESELF|TITLEOTHER|REPADMIN|GEMIT
&PERMISSIONS`ADMIN [u(cobj,group)]=ADD|DISBAND|RENAME
&GRP`GPERM`MAIN [u(cobj,group)]=@attach %!/INC`TARGET;@pemit %#=u(header,%q<g1name> - Permissions);@pemit %#=ansi(u(color,%#,GROUPS,COLUMN_NAMES),align(10 [sub(u(width,%#),11)],Permission,Holders));@pemit %#=u(separator);@dolist/inline/delimit | [u(FUN`PERMS,%q<g1>,1)]={@pemit %#=align(10 [sub(u(width,%#),11)],u(choosegame,%i0,%d0),iter(u(filter,ISOBJID,get(%q<g1>/PERM`[u(choosegame,%i0,%d0)])),u(getmoniker,%i0),%b,\,%b))};@pemit %#=u(footer)
&INC`VALID`PERMISSION [u(cobj,group)]=@check strlen(u(setr,value,ucstr(trim(stripansi(%0)))))=@attach %!/INC`MSG=ERROR: No Permission name entered!;@check regmatchi(%q<value>,v(REG`PERMISSION))=@attach %!/INC`MSG=ERROR: Permissions must contain only letters\, numbers\, and underscores.;@stop match(u(FUN`PERMS,%1,1),%q<value>,|)=@attach %!/INC`MSG=ERROR: This Permission name is already taken.
®`PERMISSION [u(cobj,group)]=\w+
&GRP`GPERM`CREATE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`VALID`PERMISSION=%0,%q<g1>;@attach %!/GRP`GPERM`CREATE`DO=%q<g1>,%q<value>;@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n Created new permission: %q<value>},OOC,1
&GRP`GPERM`CREATE`DO [u(cobj,group)]=th u(attrib_set,%0,PERMCUST,setunion(get(%0/PERMCUST),%1,|,|))
&GRP`GPERM`DELETE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`PARTIAL=%0,get(%q<g1>/PERMCUST),|,perm;@stop words(u(filter,ISOBJID,get(%q<g1>/PERM`%q<perm>)))=@attach %!/INC`MSG=ERROR: Cannot remove a Permission that players use. Check +gperm to list current holders and use +gperm/revoke to remove them.;@attach %!/GRP`GPERM`DELETE`DO=%q<g1>,%q<perm>;@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n Deleted Permission: %q<perm>},OOC,1
&GRP`GPERM`DELETE`DO [u(cobj,group)]=th u(attrib_set,%0,PERMCUST,setdiff(get(%0/PERMCUST),%1,|,|));@attach %!/WIPE=%0,PERM`%1
&GRP`GPERM`GRANT [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`PARTIAL=%0,u(FUN`PERMS,%q<g1>),|,permission;@check u(FUN`GRPPERM,%:,%q<g1>,%qchoice>)=@attach %!/INC`MSG=ERROR: Cannot grant a Permission you do not already possess.;@check strlen(%1)=@attach %!/INC`MSG=ERROR: Nobody/Nothing entered to grant to!;@dolist/inline/nobreak/delimit \, %1={@attach %!/GRP`GPERM`GRANT`DO=%q<g1>,u(choosegame,%i0,%d0),%q<permission>};@select/inline cor(words(%q<chars>),words(%q<ranks>))=1,{@attach %!/INC`MSG=Granted %q<permission> Permissions.},0,{@attach %!/INC`MSG=ERROR: Nothing matched to grant to!};@select/inline words(%q<chars>)=>0,{@attach %!/INC`MSG`NOTICE=You were granted the %q<permission> Permission in Group: %q<g1name>,%q<chars>};@dolist/inline %q<chars>=@trigger %!/GRP`CACHE`CHARACTER`GROUP=##,%q<g1>
&GRP`GPERM`GRANT`DO [u(cobj,group)]=@check strlen(%1);@select/inline u(valnum,%1)=1,{@check hasattr(%0/RANK`%1)=@attach %!/INC`MSG=ERROR: [name(%0)] does not have a Rank %1!;@check cor(u(isadmin,%#),lt(%1,get(%#/D`GROUP`[num(%0)]`RANK)))=@attach %!/INC`MSG=ERROR: Cannot modify Ranks at or beyond your own.;@stop match(get(%0/RANK`%1`PERM),%2)=@attach %!/INC`MSG=ERROR: Rank %1 already has %2!;th u(attrib_set,%0,RANK`%1`PERM,setunion(get(%0/RANK`%1`PERM),%2));th u(setq,ranks,setunion(%q<ranks>,%1));th u(setq,ranks,setunion(%qranks>,%1))},0,{@attach %!/INC`CHECKPC=%1,2;@stop if(get(%q<t1>/D`GROUP`[num(%0)]`RANK),cor(lt(get(%q<t2>/D`GROUP`[num(%0)]`RANK),get(%#/D`GROUP`[num(%0)]`RANK)),u(isadmin,%#)),0)=@attach %!/INC`MSG=ERROR: Cannot modify a superior member.;@stop strmatch(%#,%q<t2>)=@attach %!/INC`MSG=ERROR: Cannot Grant permissions to yourself.;th u(attrib_set,%q<t2>,D`GROUP`[num(%0)]`GRANTED,setunion(get(%q<t2>/D`GROUP`[num(%0)]`GRANTED),%2));th u(attrib_set,%0,PERM`%2,setunion(u(filter,ISOBJID,get(%0/PERM`%2)),%q<t2objid>));th u(setq,chars,setunion(%q<chars>,%q<t2>))}
&GRP`GPERM`REVOKE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`PARTIAL=%0,u(FUN`PERMS,%q<g1>),|;@check u(FUN`GRPPERM,%:,%q<g1>,%qchoice>)=@attach %!/INC`MSG=ERROR: Cannot Revoke a Permission you do not already possess.;@check strlen(%1)=@attach %!/INC`MSG=ERROR: Nobody/Nothing entered to grant to!;@dolist/inline/nobreak/delimit \, %1={@attach %!/GRP`GPERM`REVOKE`DO=%q<g1>,u(choosegame,%i0,%d0),%q<choice>};@attach %!/INC`MSG=Revoked %q<choice> Permissions.;@attach %!/INC`MSG`NOTICE=%q<choice> Permission revoked for Group: %q<g1name>,%q<chars>;@dolist/inline %q<chars>=@trigger %!/GRP`CACHE`CHARACTER`GROUP=##,%q<g1>
&GRP`GPERM`REVOKE`DO [u(cobj,group)]=@check strlen(%1);@select/inline u(valnum,%1)=1,{@check hasattr(%0/RANK`%1)=@attach %!/INC`MSG=ERROR: [name(%0)] does not have a Rank %1!;@check match(get(%0/RANK`%1`PERM),%2)=@attach %!/INC`MSG=ERROR: Rank %1 lacks %2!;@check cor(u(isadmin,%#),lt(%1,get(%#/D`GROUP`[num(%0)]`RANK)))=@attach %!/INC`MSG=ERROR: Cannot modify Ranks at or beyond your own.;th u(attrib_set,%0,RANK`%1`PERM,setdiff(get(%0/RANK`%1`PERM),%2));th u(setq,ranks,setunion(%q<ranks>,%1))},0,{@attach %!/INC`CHECKPC=%1,2;@stop if(get(%q<t1>/D`GROUP`[num(%0)]`RANK),cor(lt(get(%q<t1>/D`GROUP`[num(%0)]`RANK),get(%#/D`GROUP`[num(%0)]`RANK)),u(isadmin,%#)),0)=@attach %!/INC`MSG=ERROR: Cannot modify a superior member.;@stop strmatch(%#,%q<t2>)=@attach %!/INC`MSG=ERROR: Cannot Revoke permissions from yourself.;th u(attrib_set,%q<t2>,D`GROUP`[num(%0)]`GRANTED,%2);th u(attrib_set,%0,PERM`%2,setdiff(u(filter,ISOBJID,get(%0/PERM`%2)),%q<t2objid>));th u(setq,chars,setunion(%q<chars>,%q<t2>))}
&HLP`PERMISSIONS [u(cobj,group)]=Permissions can be granted to players and ranks (thereby extending them to everyone who holds that rank.) These grant privileges/abilities in the Group.%R%R[ansi(hc,Management Commands)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gperm)] - List all Permissions and the Players specially granted them.%R[ansi(h,+gperm/grant <permission>=<list>)] - Grants Permission to One or more Ranks/Players. Ranks are targeted by numbers and players by names. Separate them with commas. Example: Name1\,3\,Name4%R[ansi(h,+gperm/revoke <permission>=<list>)] - The opposite of Grant. works the same way.%R[ansi(h,+gperm/create <permission>)] - Creates a custom Permission. Can only use alphanumeric characers and the underscore. These are useful for board locks and things like that.%R[ansi(h,+gperm/delete <permission>)] - Deletes a Custom Permission if it is unused. Cannot delete Built-in Permissions.)]%R%R[ansi(hc,Built-in Permissions)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,moderate)] - May use disciplinary commands on group members.%R[ansi(h,manage)] - may manage invites\, kick players\, and alter player rank. Also grants divisional alteration powers.%R[ansi(h,bbadmin)] - may create/destroy/lock/moderate the group's BBS.%R[ansi(h,repadmin)] - Can administrate Reports for this group.%R[ansi(h,gemit)] - May use +gemit.%R[ansi(h,ic)] and [ansi(h,ooc)] - grants access to the IC and OOC group channels.%R[ansi(h,titleself)] - May use +gtitle... but only on yourself.)]
+help/addsub Groups/Permissions=[u(cobj,group)]/HLP`PERMISSIONS
@@ CACHE SECTION
&GRP`CACHE`MEMBERS [u(cobj,group)]=@attach %!/WIPE=%0,MEMBERS`*;th u(attrib_set,%0,MEMBERS,u(mysql,CACHE`MEMBER,get(%0/D`ID)));@dolist/inline/delimit | [u(mysql2,CACHE`MEMBERS,get(%0/D`ID))]={th u(attrib_set,%0,MEMBERS`[u(elements,##,1,^)],u(elements,##,2,^))};th u(attrib_set,%0,COMMAND,u(mysql,CACHE`COMMAND,get(%0/D`ID),default(%0/SET`COMMAND,2)))
&Q`CACHE`MEMBER [u(cobj,group)]=SELECT character_objid FROM volv_group_member WHERE group_id=? AND group_rank_number IS NOT NULL ORDER BY group_rank_number ASC,character_name ASC
&Q`CACHE`MEMBERS [u(cobj,group)]=SELECT group_rank_number,character_objids FROM volv_group_rankgroups WHERE group_id=? AND group_rank_number IS NOT NULL AND character_objids IS NOT NULL
&Q`CACHE`COMMAND [u(cobj,group)]=SELECT character_objid FROM volv_group_member WHERE group_id=? AND group_rank_number<=? ORDER BY group_rank_number ASC,character_name ASC
&GRP`CACHE`CHARACTER`GROUP [u(cobj,group)]=@attach %!/WIPE=%0,u(setr,attr,V`GROUP`[get(%1/D`ID)]);@select/inline isint(u(setr,rnk,get(%0/D`GROUP`[num(%1)]`RANK)))=1,{th u(vattrib_set,%0,%q<attr>,%q<rnk>)};@select/inline t(words(u(setr,prm,u(FUN`GETPERM,%1,%0))))=1,{th u(vattrib_set,%0,%q<attr>`PERMISSIONS,%q<prm>);@dolist/inline %q<prm>={th u(vattrib_set,%0,%q<attr>`PERMISSION`##,1)}}
&GRP`CACHE`CHARACTER [u(cobj,group)]=@dolist/inline u(filter,HASID,u(filter,ISDBREF,edit(u(lattr,%0/D`GROUP`*),D`GROUP`,)))={@attach %!/GRP`CACHE`CHARACTER`GROUP=objid(%0),##}
&FIL`HASID [u(cobj,group)]=t(get(%0/D`ID))
&GRP`CACHE`TIERS [u(cobj,group)]=@attach %!/WIPE=%0,V`TIERS;@dolist/inline/delimit [u(rsep)] [u(mysql3,CACHE`TIERS,get(%0/D`ID))]={th u(vattrib_set,%0,V`TIERS,trim(cat(get(%0/V`TIERS),after(##,u(fsep)))));th u(vattrib_set,%0,V`TIERS`[before(##,u(fsep))],after(##,u(fsep)))}
&Q`CACHE`TIERS [u(cobj,group)]=SELECT group_tier,group_objids FROM volv_group_member_tiers WHERE character_id=? AND group_is_private=0
@@ MEMBERSHIP SECTION
&SWITCHES`GMEMBER`PLAYER [u(cobj,group)]=ADD|KICK|INVITE|UNINVITE|RANK|JOIN|LEAVE[if(u(cobj,radio),|INITRADIO)]
&SWITCHES`DMEMBER`PLAYER [u(cobj,group)]=ADD|KICK|RANK
&SORTRANK [u(cobj,group)]=u(SORTRANK`%va,%0,if(strlen(%1),%1,%B),if(strlen(%2),%2,%B))
&SORTRANK`PENNMUSH [u(cobj,group)]=sortkey(#lambda/u(FUN`GETRANK,%q<gsort>,\%0,1),%0,n,%1,%2)
&SORTRANK`RHOSTMUSH [u(cobj,group)]=sortby(#lambda/[lit([ncomp(u(FUN`GETRANK,%q<gsort>,%0,1),u(FUN`GETRANK,%q<gsort>,%1,1))])],%0,%1,%2)
&GRP`GMEMBER`MAIN [u(cobj,group)]=@pemit %#=u(header,Extended Invites);@dolist/inline u(sortname,u(filter,INVITED,u(FUN`LISTGROUPS),%b,%b,%:))={@pemit %#=u(##/GET`NAME)[if(get(##/SEt`PRIVATE)),%B\([ansi(hr,SSSSH! PRIVATE GROUP!)]\)]};@pemit %#=u(footer)
&GRP`GMEMBER`ADD`DO [u(cobj,group)]=@check u(setr,member_id,u(call`2,volp_group_member,0,get(%0/D`ID),get(%1/D`ID)))=@attach %!/INC`MSG=ERROR: Could not add to group. Reason: %q<member_id>;th u(attrib_set,%1,D`GROUP`[num(%0)],%q<member_id>);@attach %!/GRP`GMEMBER`RANK`DO=%0,%1,u(strfirstof,%2,get(%0/SET`STARTRANK));&INVITES %0=u(filter,ISOBJID,setdiff(get(%0/INVITES),objid(%1)));@attach %!/INC`MSG`NOTICE=%3,%1;@attach %!/GRP`CACHE`MEMBERS=%0;@attach %!/GRP`CACHE`TIERS=%1;@attach %!/GRP`CACHE`CHARACTER`GROUP=%1,%0;@dolist/inline/nobreak if(%4,,IC OOC)={@check match(get(%1/V`GROUP`[get(%0/D`ID)]`PERMISSIONS),##);@attach %!/GRP`GCHANNEL`JOIN`DO=%0,%1,##};@select/inline strmatch(objid(%0),u(conf,STAFF_GROUP))=1,{th u(vattrib_set,%1,V`ADMIN,1)};@select/inline %va=PennMUSH,{@dolist/inline/delimit | [get(%0/SET`CHANNELS)]={@chan/on %i0=%1}};@dolist/inline get(%0/SET`RADIOS)={@trigger/spoof u(cobj,radio)/INC`JOIN`DO=%1,##}
&GRP`GMEMBER`RANK`DO [u(cobj,group)]=@attach %!/INC`DOSQL=UPDATE`RANK,get(%0/RANK`%2),get(%1/D`GROUP`[num(%0)]);th u(attrib_set,%1,D`GROUP`[num(%0)]`RANK,%2);@attach %!/GRP`CACHE`MEMBERS=%0;@attach %!/GRP`CACHE`CHARACTER`GROUP=%1,%0;
&Q`UPDATE`RANK [u(cobj,group)]=UPDATE vol_group_member SET rank_id=? WHERE member_id=?
&GRP`GMEMBER`KICK`DO [u(cobj,group)]=@dolist/inline/nobreak/localize get(%1/D`GROUP`[num(%0)]`DIVISIONS)={@attach %!/GRP`GMEMBER`KICK`DO=##,%1};th u(setq,member_id,get(%1/D`GROUP`[num(%0)]));@attach %!/WIPE=%1,D`GROUP`[num(%0)];@attach %!/WIPE=%1,V`GROUP`[get(%0/D`ID)];@attach %!/INC`DOSQL=DELETE`MEMBER,%q<member_id>;@attach %!/GRP`CACHE`MEMBERS=%0;@attach %!/GRP`CACHE`TIERS=%1;@select/inline strmatch(objid(%0),u(conf,STAFF_GROUP))=1,{th u(vattrib_set,%1,V`ADMIN,0)};@attach %!/GRP`CACHE`CHARACTER`GROUP=%1,%0;@dolist/inline/nobreak IC OOC={@attach %!/GRP`GCHANNEL`LEAVE`DO=%0,%1,##};@attach %!/INC`MSG=%2,%1;@dolist/inline u(setr,radios,get(%0/SET`RADIOS))={@select/inline u(u(cobj,radio)/FUN`PERMISSION,##,JOIN,objid(%1))=0,{@dolist/inline get(%1/D`RADIO_META`[num(##)])={@trigger [u(cobj,radio)]/INC`LEAVE`DO=%1,u(choosegame,%i0,%d0),u(choosegame,%i1,%d1)}}};
&Q`DELETE`MEMBER [u(cobj,group)]=DELETE FROM vol_entity WHERE entity_id=?
&DIV`DMEMBER`ADD`DO [u(cobj,group)]=th u(attrib_set,%2,D`GROUP`[num(%0)]`DIVISIONS,setunion(get(%2/D`GROUP`[num(%0)]`DIVISIONS),objid(%1)));@attach %!/GRP`GMEMBER`ADD`DO=%1,%2,%3,%4,1
&GRP`GMEMBER`ADD [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,ADD)=@attach %!/INC`MSG=ERROR: You do not have permission to do that.;@attach %!/INC`CHECKPC=%0,1;@stop match(get(%q<g1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are already a member of the Group.;@select/inline strlen(%1)=>0,{@check cand(isint(%1),get(%q<g1>/RANK`%1))=@attach %!/INC`MSG=ERROR: Rank '%1' does not exist!};@attach %!/GRP`GMEMBER`ADD`DO=%q<g1>,%q<t1>,%1,Added you to the %q<g1name> Group!;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Added %q<t1name>.};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n added %q<t1name> to the Group!},OOC,1;
&DIV`DMEMBER`ADD [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: You do not have permission to do that.;@attach %!/INC`FINDDIV=before(%0,/);@attach %!/INC`CHECKPC=after(%0,/),1;@check match(get(%q<g1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are not a member of the Group.;@stop match(get(%q<d1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are already a member of the Division.;@select/inline strlen(%1)=>0,{@check cand(isint(%1),get(%q<d1>/RANK`%1))=@attach %!/INC`MSG=ERROR: Rank '%1' does not exist!};@attach %!/DIV`DMEMBER`ADD`DO=%q<g1>,%q<d1>,%q<t1>,%1,Added you to %q<g1name>'s '%q<d1name>' Division!;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Added %q<t1name>.};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n added %q<t1name> to the '%q<d1name>' Division!},OOC,1
&GRP`GMEMBER`LEAVE [u(cobj,group)]=@attach %!/INC`TARGET;@check match(get(%q<g1>/MEMBERS),%:)=@attach %!/INC`MSG=ERROR: You are not a member of %q<g1name>!;@stop eq(1,u(FUN`GETRANK,%q<g1>,%:))=@attach %!/INC`MSG=ERROR: Leaders may not leave their groups. Please contact staff.;@attach %!/INC`VERIFY={[ansi(hr,WARNING:)] Really leave the group? Enter the command again to verify.},LEAVE %q<g1>;@attach %!/GRP`GMEMBER`KICK`DO=%q<g1>,%#,{You left the %q<g1name> Group!};@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{%q<t1name> left the group.};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n left the Group},OOC,1
&GRP`GMEMBER`KICK [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: You do not have permission to do that.;@attach %!/INC`CHECKPC=%0,1;@check match(get(%q<g1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are not a member of the Group.;@check cor(u(isadmin,%#),gt(get(%q<t1>/D`GROUP`%q<g1>`RANK),get(%#/D`GROUP`%q<g1>`RANK)))=@attach %!/INC`MSG=ERROR: Cannot kick equal or superior members.;@attach %!/GRP`GMEMBER`KICK`DO=%q<g1>,%q<t1>,You were kicked from the %q<g1name> Group!;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Kicked %q<t1name>.};@attach %!/INC`MSG=You have kicked %q<t1name> from the %q<g1name>!;@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n Kicked %q<t1name> from the Group!},OOC,1
&DIV`DMEMBER`KICK [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: You do not have permission to do that.;@attach %!/INC`FINDDIV=before(%0,/);@attach %!/INC`CHECKPC=after(%0,/),1;@check match(get(%q<g1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are not a member of the Group.;@check match(get(%q<d1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are not a member of the Division.;@attach %!/GRP`GMEMBER`KICK`DO=%q<d1>,%q<t1>,You were kicked from the %q<g1name>'s '%q<d1name>' Division!;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Kicked %q<t1name>.};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n Kicked %q<t1name> from the '%q<d1name>' Division!},OOC,1
&GRP`GMEMBER`INVITE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: You do not have permission to do that.;@select/inline strlen(%0)=0,{@attach %!/INC`MSG=The [u(%q<g1>/GET`NAME)] has invitations out to: [iter(u(filter,ISOBJID,get(%q<g1>/INVITES)),u(getmoniker,%i0),%b,\,%b)]},{@attach %!/INC`CHECKPC=%0,1;@stop match(get(%q<g1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are already a member of the Group.;@stop match(get(%q<g1>/INVITES),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are already invited.;@attach %!/GRP`GMEMBER`INVITE`DO=%q<g1>,%q<t1>,You are invited to join the [if(get(%q<g1>/SET`PRIVATE),\([ansi(hr,PRIVATE GROUP! SSSSSSHHHHH!!!!)]\)%B)]%q<g1name>! To do so: [u(pueblize,+gmember/join %q<g1name>)];@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Invited %q<t1name>.};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n invited %q<t1name> to the Group!},OOC,1}
&GRP`GMEMBER`INVITE`DO [u(cobj,group)]=th u(attrib_set,%0,INVITES,u(filter,ISOBJID,setunion(get(%0/INVITES),objid(%1))));@attach %!/INC`MSG=%2,%1
&GRP`GMEMBER`UNINVITE [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: You do not have permission to do that.;@select/inline strlen(%0)=0,{@attach %!/INC`MSG=The [u(%q<g1>/GET`NAME)] has invitations out to: [iter(u(filter,ISOBJID,get(%q<g1>/INVITES)),u(getmoniker,%i0),%b,\,%b)]},{@attach %!/INC`CHECKPC=%0,1;@stop match(get(%q<g1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are already a member of the Group.;@check match(get(%q<g1>/INVITES),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are not invited.;@attach %!/GRP`GMEMBER`UNINVITE`DO=%q<g1>,%q<t1>,Your invitation to the [if(get(%q<g1>/SET`PRIVATE),\([ansi(hr,PRIVATE GROUP! SSSSSSHHHHH!!!!)]\)%B)]%q<g1name> was revoked.;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Revoked Invitation for %q<t1name>.};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n revoked invitation for %q<t1name>!},OOC,1}
&GRP`GMEMBER`UNINVITE`DO [u(cobj,group)]=th u(attrib_set,%0,INVITES,u(filter,ISOBJID,setdiff(get(%0/INVITES),objid(%1))));@attach %!/INC`MSG=%2,%1
&GRP`GMEMBER`JOIN [u(cobj,group)]=@attach %!/INC`FINDGROUP=%0,1;@check match(get(%q<g1>/INVITES),%:)=@attach %!/INC`MSG=ERROR: Sorry. No invites pending for you.;@stop match(get(%q<g1>/MEMBERS),%:)=@attach %!/INC`MSG=ERROR: Already a member of %q<g1name>.;@attach %!/GRP`GMEMBER`ADD`DO=%q<g1>,%#,,Welcome to the [if(get(%q<g1>/SET`PRIVATE),\([ansi(hr,PRIVATE GROUP! SSSSSSHHHHH!!!!)]\)%B)]%q<g1name>!;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Joined %q<g1name>.};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n joined the Group!},OOC,1
&GRP`GMEMBER`RANK [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: You do not have permission to do that.;@attach %!/INC`CHECKPC=%0,1;@check match(get(%q<g1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are not a member of the Group.;@check cand(isint(%1),get(%q<g1>/RANK`%1))=@attach %!/INC`MSG=ERROR: Rank '%1' does not exist!;@check cor(u(isadmin,%#),lt(get(%#/D`GROUP`%q<g1>`RANK),get(%q<t1>/D`GROUP`%q<g1>`RANK)))=@attach %!/INC`MSG=ERROR: Cannot change the rank of equals or superiors.;@check cor(u(isadmin,%#),lt(get(%#/D`GROUP`%q<g1>`RANK),%1))=@attach %!/INC`MSG=ERROR: Cannot assign a rank equal or greater to your own.;@attach %!/GRP`GMEMBER`RANK`DO=%q<g1>,%q<t1>,%1,Your %q<g1name> Rank is now: %1 '[get(%q<g1>/RANK`%1`NAME)]';@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Altered %q<t1name> to Rank %1.};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n changed %q<t1name> to Rank %1 '[get(%q<g1>/RANK`%1`NAME)]'!},OOC,1
&DIV`DMEMBER`RANK [u(cobj,group)]=@attach %!/INC`TARGET;@check u(FUN`GRPPERM,%:,%q<g1>,MANAGE)=@attach %!/INC`MSG=ERROR: You do not have permission to do that.;@attach %!/INC`FINDDIV=before(%0,/);@attach %!/INC`CHECKPC=after(%0,/),1;@check match(get(%q<g1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are not a member of the Group.;@check match(get(%q<d1>/MEMBERS),%q<t1objid>)=@attach %!/INC`MSG=ERROR: They are not a member of the Division.;@check cand(isint(%1),get(%q<d1>/RANK`%1))=@attach %!/INC`MSG=ERROR: Rank '%1' does not exist!;@attach %!/GRP`GMEMBER`RANK`DO=%q<d1>,%q<t1>,%1,Your %q<g1name> Rank for Division '%q<d1name>' is now: %1 '[get(%q<g1>/RANK`%1`NAME)]';@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Altered %q<t1name> to Rank %1 for Division '%q<d1name>'.};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n changed %q<t1name> to Rank %1 '[get(%q<d1>/RANK`%1`NAME)]' for Division '%q<d1name>'!},OOC,1
&GRP`GMEMBER`INITRADIO [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/GRP`GMEMBER`INITRADIO`DO=%q<g1>,%:;@attach %!/INC`MSG=Initialized Radio!
&GRP`GMEMBER`INITRADIO`DO [u(cobj,group)]=@dolist/inline u(filter,ISOBJID,get(%0/SET`RADIOS))={@trigger [u(cobj,radio)]/INC`JOIN`DO=%1,##}
&HLP`MEMBERSHIP [u(cobj,group)]=[ansi(hc,Inviting Members)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gmember/invite)] - Show all extended invitations.%R[ansi(h,+gmember/invite <player>)] - Send an invite.%R[ansi(h,+gmember/uninvite <player>)] - Revoke a pending invitation.)]%R%R[ansi(hc,Joining Groups)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gmember)] - Shows all groups who've invited you to join.%R[ansi(h,+gmember/join <group>)] - Accepts an offered invite.%R[ansi(h,+grefuse <group>)] - Rejects an offered invite.%R[ansi(h,+gmember/add <character>)] - Adds a player to a group directly. Generally admin-only.)]%R%R[ansi(hc,Removing Members)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gmember/leave)] - Leaves a group.%R[ansi(h,+gmember/kick <player>)] - Removes <player> from group. Requires MANAGE permission.)]%R%R[ansi(hc,Promoting Members)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gmember/rank <player>=<#>)] - Alter a player's rank to <#>. Can only be used on subordinates\, and not to your own rank or better. Requires the Manage permission.)]%R%R[ansi(hc,Titles)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gtitle <player>=<text>)] - Alter a player's group title. Requires the TITLESELF or TITLEOTHER permission as appropriate.)]
+help/addsub Groups/Membership=[u(cobj,group)]/HLP`MEMBERSHIP
@@ LISTING SECTION
&SWITCHES`GROUPS`PLAYER [u(cobj,group)]=PRIVATE|CUSTCOLORS|COLORS|OPTIONS
&SWITCHES`GROUP`PLAYER [u(cobj,group)]=ALL|CUSTCOLORS|COLORS|OPTIONS
&GRP`GROUP`OPTIONS [u(cobj,group)]=@attach %!/INC`OPTIONS=%0,%1,GROUPS
&GRP`GROUPS`OPTIONS [u(cobj,group)]=@attach %!/INC`OPTIONS=%0,%1,GROUPS
&OPTION`OPTIONS [u(cobj,group)]=FOCUS
&OPTION`FOCUS [u(cobj,group)]=Does +group <group> change focus?
&OPTION`FOCUS`DEFAULT [u(cobj,group)]=0
&OPTION`FOCUS`VALID [u(cobj,group)]=BOOL
&GRP`GROUP`CUSTCOLORS [u(cobj,group)]=@attach %!/CUSTCOLORS
&GRP`GROUPS`CUSTCOLORS [u(Cobj,group)]=@attach %!/CUSTCOLORS
&GRP`GROUPS`COLORS [u(cobj,group)]=@attach %!/INC`COLOR=%0,%1,GROUPS
&GRP`GROUP`COLORS [u(cobj,group)]=@attach %!/INC`COLOR=%0,%1,GROUPS
&CUSTCOLORS [u(cobj,group)]=th u(setq,groups,u(FUN`LISTGROUPS,%:));@switch/inline strlen(%0)=0,{@attach %!/CUSTCOLORS`LIST},{@attach %!/CUSTCOLORS`SET}
&CUSTCOLORS`LIST [u(cobj,group)]=@pemit %#=u(header,Group Color);@pemit %#=ansi(u(color,%#,GROUPS,COLUMN_NAMES),align(34 10,Group,Color));@pemit %#=u(separator);@dolist/inline %q<groups>={@pemit %#=align(34 10,u(getmoniker,##),u(groupcolor,%#,##))};@pemit %#=u(footer)
&CUSTCOLORS`SET [u(cobj,group)]=@attach %!/INC`VALID`GROUP=%0;th u(setq,g1,%num(%q<value>));@switch/inline strlen(%2)=0,{@attach %!/INC`MSG=GROUP [name(%q<g1>)] restored to default.;@attach %!/WIPE=u(strfirstof,u(accid,%#),%#),CUSTCOLOR`GROUP`%q<g1>},{@attach %!/INC`VALID`COLOR=%2;th u(attrib_set,u(strfirstof,u(accid,%#),%#),CUSTCOLOR`GROUP`%q<g1>,%q<value>);@attach %!/INC`MSG=u(setr,msg,GROUP [name(%q<g1>)] Set to: %q<value>)}
&GRP`GWHO`MAIN [u(cobj,group)]=@select/inline strlen(%0)=0,{@attach %!/INC`TARGET},{@attach %!/INC`FINDGROUP=%0,1};th u(setq,online,1);th u(setq,all,0);@attach %!/GRP`GWHO`LIST
&GRP`GROUP`MAIN [u(cobj,group)]=@select/inline strlen(%0)=0,{@attach %!/INC`TARGET},{@attach %!/INC`FINDGROUP=%0,1};th u(setq,online,0);th u(setq,all,0);@attach %!/GRP`GWHO`LIST;@select/inline t(u(op,GROUPS,FOCUS))=1,{@check u(FIL`CANFOCUS,%q<g1>,%:);@attach %!/GRP`GFOCUS`MAIN`DO=%q<g1>}
&GRP`GROUP`ALL [u(cobj,group)]=@select/inline strlen(%0)=0,{@attach %!/INC`TARGET},{@attach %!/INC`VALID`GROUP=%0,1};th u(setq,online,0);th u(setq,all,1);@attach %!/GRP`GWHO`LIST
&DISPLAY`STANDARD [u(cobj,group)]=@pemit %#=ansi(u(color,%#,GROUPS,COLUMN_NAMES),align(24 20 25 6,Name,Rank,Title,Idle))%R[u(separator)];@dolist/inline/delimit [u(rsep)] [u(filter,GAPPROVE,u(filter,if(%q<online>,ONLINE,EXISTMEMBER),u(mysql3,SELECT`MEMBERS,%q<g1id>),u(rsep),u(rsep),%q<lwhoid>),u(rsep),u(rsep),cor(%q<all>,u(conf,SHOW_UNAPPROVED)))]={@pemit %#=align(24 20 25 >6,u(pueblize,u(getmoniker,u(setr,mem,u(elements,u(setr,data,u(choosegame,%i0,%d0)),1,u(fsep)))),+finger [name(%q<mem>)]),u(elements,%q<data>,3,u(fsep)),u(elements,%q<data>,4,u(fsep)),u(lastidle,%q<mem>,%#))}
&FIL`GAPPROVE [u(cobj,group)]=cor(%1,u(isapproved,first(%0,u(fsep))))
&DISPLAY`DIVISIONAL [u(cobj,group)]=@pemit %#=ansi(u(color,%#,GROUPS,COLUMN_NAMES),align(23 5 21 20 6,Name,R#,Rank,Title,Idle));@attach %!/DISPLAY`DIVISIONAL`COMMAND;@dolist/inline u(filter,ISOBJID,get(%q<g1>/DIVISIONS))={@attach %!/DISPLAY`DIVISIONAL`DIVISION=%q<g1>,##};@attach %!/DISPLAY`DIVISIONAL`UNASSIGNED;
&DISPLAY`DIVISIONAL`COMMAND [u(cobj,group)]=@pemit %#=u(separator,Command Staff);@dolist/inline/delimit [u(rsep)] [u(filter,GAPPROVE,u(filter,if(%q<online>,ONLINE,EXISTMEMBER),u(mysql3,SELECT`RANK_COMPARE,%q<g1id>,<=[default(%q<g1>/SET`COMMAND,2)]),u(rsep),u(rsep),%q<lwhoid>),u(rsep),u(rsep),cor(%q<all>,u(conf,SHOW_UNAPPROVED)))]={@pemit %#=align(23 5 21 19 >6,u(pueblize,u(getmoniker,u(setr,mem,first(u(setr,data,u(choosegame,%i0,%d0)),u(fsep)))),+finger [name(%q<mem>)]),u(setr,rnk,default(%q<mem>/D`GROUP`%q<g1>`RANK,?)),get(%q<g1>/RANK`%q<rnk>`NAME),get(%q<mem>/D`GROUP`%q<g1>`TITLE),u(lastidle,%q<mem>,%#))};
&DISPLAY`DIVISIONAL`DIVISION [u(cobj,group)]=@pemit %#=u(separator,u(%1/GET`NAME));@dolist/inline/delimit [u(rsep)] [u(filter,GAPPROVE,u(filter,if(%q<online>,ONLINE,EXISTMEMBER),u(mysql3,SELECT`MEMBERS,get(%1/D`ID)),u(rsep),u(rsep),%q<lwhoid>),u(rsep),u(rsep),cor(%q<all>,u(conf,SHOW_UNAPPROVED)))]={@pemit %#=align(23 5 21 19 >6,u(pueblize,u(getmoniker,u(setr,mem,first(u(setr,data,u(choosegame,%i0,%d0)),u(fsep)))),+finger [name(%q<mem>)]),default(%q<mem>/D`GROUP`[num(%0)]`RANK,?)-[u(elements,%q<data>,2,u(fsep))],u(elements,%q<data>,3,u(fsep)),u(strfirstof,u(elements,%q<data>,4,u(fsep)),get(%q<mem>/D`GROUP`[num(%0)]`TITLE)),u(lastidle,%q<mem>,%#))}
&DISPLAY`DIVISIONAL`UNASSIGNED [u(cobj,group)]=@pemit %#=u(separator,Unassigned Members);@dolist/inline/delimit [u(rsep)] [u(filter,GAPPROVE,u(filter,if(%q<online>,ONLINE,EXISTMEMBER),u(mysql3,SELECT`MEMBERS_UNASSIGNED,%q<g1id>,%q<g1id>,>[default(%q<g1>/SET`COMMAND,2)]),u(rsep),u(rsep),%q<lwhoid>),u(rsep),u(rsep),u(conf,SHOW_UNAPPROVED))]={@pemit %#=align(23 5 21 19 >6,u(pueblize,u(getmoniker,u(setr,mem,first(u(setr,data,u(choosegame,%i0,%d0)),u(fsep)))),+finger [name(%q<mem>)]),u(setr,rnk,default(%q<mem>/D`GROUP`%q<g1>`RANK,?)),get(%q<g1>/RANK`%q<rnk>`NAME),get(%q<mem>/D`GROUP`%q<g1>`TITLE),u(lastidle,%q<mem>,%#))};
&Q`SELECT`RANK_COMPARE [u(cobj,group)]=SELECT character_objid,group_rank_number,group_rank_title,group_member_title FROM volv_group_member WHERE group_id=? AND group_rank_number! ORDER BY group_rank_number ASC,character_name ASC
&Q`SELECT`MEMBERS [u(cobj,group)]=SELECT character_objid,group_rank_number,group_rank_title,group_member_title FROM volv_group_member WHERE group_id=? ORDER BY group_rank_number ASC,character_name ASC
&Q`SELECT`MEMBERS_UNASSIGNED [u(cobj,group)]=SELECT character_objid,group_rank_number,group_rank_title,group_member_title FROM volv_group_member WHERE group_id=? AND character_id NOT IN (SELECT character_id FROM volv_group_member WHERE group_parent=?) AND group_rank_number! ORDER BY group_rank_number ASC,character_name ASC
&FIL`ONLINE [u(cobj,group)]=t(match(%1,before(%0,u(fsep))))
&FIL`EXISTMEMBER [u(cobj,group)]=u(FIL`ISOBJID,before(%0,u(fsep)))
&GRP`GWHO`LIST [u(cobj,group)]=th u(setq,lwhoid,u(lwhoid,%#));@pemit %#=u(header,if(%q<online>,ONLINE%B)MEMBERS: %q<g1name>);@select/inline cand(not(%2),hasattr(%q<g1>/DESCRIBE))=1,{@pemit %#=get(%q<g1>/DESCRIBE);@pemit %#=u(separator)};@attach %!/DISPLAY`[u(strfirstof,get(%q<g1>/SET`DISPLAYMODE),STANDARD)];@pemit %#=u(FOOTER)
&DIV`DIVISIONS`MAIN [u(cobj,group)]=@attach %!/INC`TARGET;@pemit %#=u(HEADER,DIVISIONS: %q<g1name>);@pemit %#=ansi(u(color,%#,GROUPS,COLUMN_NAMES),align(24 21 20 10,Name,Rank,Title,Last/Idle));th u(setq,divcount,NULL);@dolist/inline/delimit [u(rsep)] [u(mysql3,SELECT`DIVISION_CASCADE,%q<g1id>)]={th u(setq,ddat,u(choosegame,%i0,%d0));th u(setq,divs,setunion(u(elements,%q<ddat>,1,u(fsep)),%q<divs>));@select/inline strmatch(u(elements,%q<ddat>,1,u(fsep)),%q<divcount>)=0,{@pemit %#=u(separator,u(elements,%q<ddat>,1,u(fsep))/GET`NAME))};th u(setq,divcount,u(elements,%q<ddat>,1,u(fsep)));@pemit %#=align(24 21 19 >10,u(pueblize,u(getmoniker,u(setr,obj,u(elements,%q<ddat>,2,u(fsep)))),+finger [name(%q<obj>)]),u(elements,%q<ddat>,4,u(fsep)),u(elements,%q<ddat>,5,u(fsep)),u(lastidle,%q<obj>,%#))};@select/inline if(words(%q<divs>),words(u(setr,empty,u(mysql,SELECT`EMPTY_DIVISIONS`1,%q<g1id>,u(SQL`IN`STRING,%q<divs>)))),words(u(setr,empty,u(mysql,SELECT`EMPTY_DIVISIONS`2,%q<g1id>))))=>0,{@pemit %#=u(subheader,Empty Divisions);@pemit %#=iter(%q<empty>,u(%i0/GET`NAME),%b,\,%B)};@pemit %#=u(FOOTER)
&Q`SELECT`EMPTY_DIVISIONS`1 [u(cobj,group)]=SELECT group_objid FROM volv_group WHERE group_parent=? AND group_objid NOT IN (!) ORDER BY group_name
&Q`SELECT`EMPTY_DIVISIONS`2 [u(Cobj,group)]=SELECT group_objid FROM volv_group WHERE group_parent=? ORDER BY group_name
&Q`SELECT`DIVISION_CASCADE [u(cobj,group)]=SELECT group_objid,character_objid,group_rank_number,group_rank_title,group_member_title FROM volv_group_member WHERE group_parent=? ORDER BY group_name ASC,group_rank_number ASC,character_name ASC
&GRP`GROUPS`PRIVATE [u(cobj,group)]=@attach %!/DISPLAY`GROUPLIST=1
&GRP`GROUPS`MAIN [u(cobj,group)]=@attach %!/DISPLAY`GROUPLIST=0
&DISPLAY`GROUPLIST [u(cobj,group)]=th u(setq,lwhoid,u(lwhoid,%#));@pemit %#=u(header,mudname() [if(%0,\(Private\)%B)]Groups);th u(setq,glist,u(mysql3,LIST`GROUP_TIERS,%0));@dolist/inline/nobreak/delimit [u(rsep)] %q<glist>={th u(setq,data,u(choosegame,%i0,%d0));th u(setq,vis,if(%0,u(filter,PRIVATE,u(elements,%q<data>,3,u(fsep)),%b,%b,%:),u(elements,%q<data>,3,u(fsep))));@check t(words(%q<vis>,u(fsep)));@pemit %#=u(separator,Tier [u(elements,%q<data>,1,u(fsep))]: [u(elements,%q<data>,2,u(fsep))],,,,,,,,2);@dolist/inline %q<vis>={th u(setq,gdat,u(choosegame,%i0,%d0));@pemit %#=align(27 20 20 7,u(pueblize,u(%q<gdat>/GET`NAME),+group [name(%q<gdat>)]),u(FUN`LISTRANKNAMES,%q<gdat>,1),u(FUN`LISTRANKNAMES,%q<gdat>,2),rjust(words(setinter(%q<lwhoid>,u(setr,members,u(filter,ISOBJID,get(%q<gdat>/MEMBERS))))),2,0)/[rjust(words(%q<members>),2,0)])}};@pemit %#=u(footer,'+group <groupname>' for details)
&Q`LIST`GROUP_TIERS [u(cobj,group)]=SELECT group_tier,tier_name,group_objids FROM volv_group_tiers WHERE group_parent IS NULL AND group_is_private=?
&FUN`LISTRANKNAMES [u(cobj,group)]=u(strfirstof,iter(u(filter,GAPPROVE,u(filter,ISOBJID,get(%0/MEMBERS`%1)),%b,%b,u(conf,SHOW_UNAPPROVED)),u(pueblize,u(getmoniker,%i0),+finger [name(%i0)]),%b,%r),None)
@@ TITLE SETTING
&INC`VALID`GROUPTITLE [u(cobj,group)]=@check strlen(u(setr,value,trim(%0)))=@attach %!/INC`MSG=ERROR: Nothing entered for a title!;@stop u(charsearch,%q<value>,u(badchars))=@attach %!/INC`MSG=ERROR: Bad title! Try without characters: [v(badchars)];@stop gte(strlen(%q<value>),51)=@attach %!/INC`MSG=ERROR: Bit long for a title...
&GRP`GTITLE`MAIN [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`CHECKPC=%0,1;@check cor(get(%q<t1>/D`GROUP`%q<g1>`GRANTED),get(%q<t1>/D`GROUP`%q<g1>`RANK),u(isadmin,%q<t1>))=@attach %!/INC`MSG=ERROR: Giving them a title would be pointless. They cannot access the group.;@select/inline %#=%q<t1>,{@check cor(u(FUN`GRPPERM,%:,%q<g1>,MANAGE),u(FUN`GRPPERM,%:,%q<g1>,TITLESELF))=@attach %!/INC`MSG=ERROR: Permission denied. You do not have the TITLESELF privilege.},{@check cor(u(FUN`GRPPERM,%:,%q<g1>,MANAGE),u(FUN`GRPPERM,%:,%q<g1>,TITLEOTHER))=@attach %!/INC`MSG=ERROR: Permission denied. You do not have the TITLESELF privilege.;@check cor(strmatch(%#,%q<t1>),u(isadmin,%#),lt(get(%#/D`GROUP`%q<g1>`RANK),get(%q<t1>/D`GROUP`%q<g1>`RANK)))=@attach %!/INC`MSG=ERROR: Only subordinates may be retitled.};@attach %!/INC`VALID`GROUPTITLE=%1;@attach %!/GRP`GTITLE`SET`DO=%q<g1>,%q<t1>,%q<value>;@attach %!/INC`MSG=You have set [if(strmatch(%#,%q<t1>),your,%q<t1name>'s)] Title in [ansi(hw,%q<g1name>)] to: %q<value>;@select/inline strmatch(%#,%q<t1>)=0,{@attach %!/INC`MSG=your title in [ansi(hw,%q<g1name>)] is now: %q<value>,%q<t1>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{if(strmatch(%#,%q<t1>),%n,%q<t1name>)'s TITLE set to: %q<value>}}
&GRP`GTITLE`SET`DO [u(cobj,group)]=@select/inline t(u(setr,member_id,get(%1/D`GROUP`[num(%0)])))=1,{@attach %!/INC`DOSQL=UPDATE`TITLE,%2,%q<member_id>};th u(attrib_set,%1,D`GROUP`[num(%0)]`TITLE,%2)
&Q`UPDATE`TITLE [u(cobj,group)]=UPDATE vol_entity SET entity_name=? WHERE entity_id=?
&DIV`DTITLE`MAIN [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`FINDDIV=%0;@attach %!/INC`CHECKPC=after(%0,/),1;@check get(%q<t1>/D`GROUP`%q<d1>`RANK)=@attach %!/INC`MSG=ERROR: Giving them a title would be pointless.;@select/inline %#=%q<t1>,{@check cor(u(FUN`GRPPERM,%:,%q<g1>,MANAGE),u(FUN`GRPPERM,%:,%q<g1>,TITLESELF))=@attach %!/INC`MSG=ERROR: Permission denied. You do not have the TITLESELF privilege.},{@check cor(u(FUN`GRPPERM,%:,%q<g1>,MANAGE),u(FUN`GRPPERM,%:,%q<g1>,TITLEOTHER))=@attach %!/INC`MSG=ERROR: Permission denied. You do not have the TITLESELF privilege.;@check cor(strmatch(%#,%q<t1>),u(isadmin,%#),lt(get(%#/D`GROUP`%q<g1>`RANK),get(%q<t1>/D`GROUP`%q<g1>`RANK)))=@attach %!/INC`MSG=ERROR: Only subordinates may be retitled.};@attach %!/INC`VALID`GROUPTITLE=%1;@attach %!/GRP`GTITLE`SET`DO=%q<d1>,%q<t1>,%q<value>;@attach %!/INC`MSG=You have set [if(strmatch(%#,%q<t1>),your,%q<t1name>'s)] Title in [ansi(hw,%q<g1name>)] to: %q<value>;@select/inline strmatch(%#,%q<t1>)=0,{@attach %!/INC`MSG=your title in [ansi(hw,%q<g1name>)]'s %q<d1name> Division is now: %q<value>,%q<t1>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{if(strmatch(%#,%q<t1>),%n,%q<t1name>)'s Division '%q<d1name>' TITLE set to: %q<value>}}
@@ CHANNEL CONTROLS
&SWITCHES`GCHANNEL`PLAYER [u(cobj,group)]=MUZZLE|JOIN|LEAVE|GAG|UNGAG|RECALL
&INC`VALID`GCHANNEL [u(cobj,group)]=@check strlen(%0)=@attach %!/INC`MSG=ERROR: Must enter a channel!;@attach %!/INC`PARTIAL=%0,IC|OOC,|,chan,Channel Type;
&GRP`GCHANNEL`MUZZLE [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`VALID`GCHANNEL=%0;@attach %!/INC`CHECKPC=%1,1;@attach %!/GRP`GCHANNEl`MUZZLE`START
&GRP`GCHANNEL`MUZZLE`START [u(cobj,group)]=@check u(FUN`GRPPERM,%:,%q<g1>,MODERATE)=@attach %!/INC`MSG=ERROR: You lack permission to do that.;@check cor(get(%q<t1>/D`GROUP`%q<g1>`GRANTED),get(%q<t1>/D`GROUP`%q<g1>`RANK),u(isadmin,%q<t1>))=@attach %!/INC`MSG=ERROR: Muzzling them would be pointless. They cannot access the group.;@check cor(u(isadmin,%#),lte(get(%#/D`GROUP`%q<g1>`RANK),get(%q<t1>/D`GROUP`%q<g1>`RANK)))=@attach %!/INC`MSG=ERROR: Permission denied..;@select/inline %2=0,{@attach %!/GRP`GCHANNEL`UNMUZZLE`DO=%q<g1>,%q<t1>,%q<chan>;@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{UnMuzzled %q<t1name> from [ucstr(%q<chan>)] channels};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n Unmuzzled %q<t1name> from [ucstr(%q<chan>)] channels},OOC,1},{@attach %!/INC`VALID`DURATION=%2;@attach %!/GRP`GCHANNEL`MUZZLE`DO=%q<g1>,%q<t1>,%q<chan>,u(setr,expires,add(secs(),%q<value>));@attach %!/INC`CODE`MAKELOG=%:,%q<g1>,{Muzzled %q<t1name> from [ucstr(%q<chan>)] channels for [etime(%q<value>)] - Until [convsecs(%q<expires>)]};@attach %!/INC`CODE`CHAT={[ansi(hw,ALERT:)] %n muzzled %q<t1name> from [ucstr(%q<chan>)] channels for [etime(%q<value>)] - Until [convsecs(%q<expires>)]},OOC,1}
&GRP`GCHANNEL`MUZZLE`DO [u(cobj,group)]=th u(attrib_set,%1,D`GROUP`[num(%0)]`MUZZLE`%2,%3);
&GRP`GCHANNEL`UNMUZZLE`DO [u(cobj,group)]=@attach %!/WIPE=%1,D`GROUP`[num(%0)]`MUZZLE`%2
&GRP`GCHANNEL`JOIN [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`VALID`GCHANNEL=%0;@attach %!/GRP`GCHANNEl`JOIN`START
&GRP`GCHANNEL`JOIN`START [u(cobj,group)]=@check u(FUN`GRPPERM,%:,%q<g1>,%q<chan>)=@attach %!/INC`MSG=ERROR: You lack permission to do that.;@stop match(get(%q<g1>/CHANNEL`%q<chan>),%:)=@attach %!/INC`MSG=ERROR: You are already joined to that channel!;@attach %!/GRP`GCHANNEL`JOIN`DO=%q<g1>,%#,%q<chan>;@attach %!/INC`MSG=You have joined the %q<g1name> %q<chan> Channel!
&GRP`GCHANNEL`JOIN`DO [u(cobj,group)]=th u(attrib_set,%0,CHANNEL`%2,u(filter,ISOBJID,setunion(get(%0/CHANNEL`%2),objid(%1))))
&GRP`GCHANNEL`LEAVE [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`VALID`GCHANNEL=%0;@attach %!/GRP`GCHANNEl`LEAVE`START
&GRP`GCHANNEL`LEAVE`START [u(cobj,group)]=@check u(FUN`GRPPERM,%:,%q<g1>,%q<chan>)=@attach %!/INC`MSG=ERROR: You lack permission to do that.;@check match(get(%q<g1>/CHANNEL`%q<chan>),%:)=@attach %!/INC`MSG=ERROR: You are not joined to that channel!;@attach %!/GRP`GCHANNEL`LEAVE`DO=%q<g1>,%#,%q<chan>;@attach %!/INC`MSG=You have left the %q<g1name> %q<chan> Channel!
&GRP`GCHANNEL`LEAVE`DO [u(cobj,group)]=th u(attrib_set,%0,CHANNEL`%2,u(filter,ISOBJID,setdiff(get(%0/CHANNEL`%2),objid(%1))))
&GRP`GCHANNEL`GAG [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`VALID`GCHANNEL=%0;@attach %!/GRP`GCHANNEl`GAG`START
&GRP`GCHANNEL`GAG`START [u(cobj,group)]=@stop get(%#/D`GROUP`%q<g1>`GAG`%q<chan>)=@attach %!/INC`MSG=ERROR: Gag is currently on already!;@attach %!/GRP`GCHANNEl`GAG`DO=%#,%q<g1>,%q<chan>;@attach %!/INC`MSG=Gagged the %q<g1name> %q<chan> Channel!
&GRP`GCHANNEL`GAG`DO [u(cobj,group)]=th u(attrib_set,%0,D`GROUP`%1`GAG`%2,1)
&GRP`GCHANNEL`UNGAG [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`VALID`GCHANNEL=%0;@attach %!/GRP`GCHANNEl`UNGAG`START
&GRP`GCHANNEL`UNGAG`START [u(cobj,group)]=@check get(%#/D`GROUP`%q<g1>`GAG`%q<chan>)=@attach %!/INC`MSG=ERROR: Gag is not on!;@attach %!/GRP`GCHANNEl`UNGAG`DO=%#,%q<g1>,%q<chan>;@attach %!/INC`MSG=Un-gagged the %q<g1name> %q<chan> Channel!
&GRP`GCHANNEL`UNGAG`DO [u(cobj,group)]=th u(attrib_set,%0,D`GROUP`%1`GAG`%2,0)
&GRP`GCHANNEL`MAIN [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`CODE`CHAT=%1[if(strlen(%2),=%2)],%0,0
&GRP`GEMIT`MAIN [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`VALID`GCHANNEL=%0;@check u(FUN`GRPPERM,%:,%q<g1>,GEMIT)=@attach %!/INC`MSG=ERROR: Permission denied.;@attach %!/INC`CODE`CHAT=%1,%q<chan>,,1
&INC`CODE`CHAT [u(cobj,group)]=@check strlen(%0)=@pemit %#=What will you say?;@select/inline cor(%2,%3)=0,{@check get(%q<g1>/SET`[u(setr,chan,%1)])=@attach %!/INC`MSG=ERROR: That channel is not enabled.;@check u(conf,%q<chan>)=@attach %!/INC`MSG=ERROR: %q<chan> Group Channels are globally disabled.;@check u(FUN`GRPPERM,%:,%q<g1>,%q<chan>)=@attach %!/INC`MSG=ERROR: Permission denied.;@check cor(gt(secs(),u(setr,until,default(%#/D`GROUP`%q<g1>`MUZZLE`%q<chan>,0))),u(isadmin,%#))=@attach %!/INC`MSG=ERROR: You are muzzled from [name(%q<g1>)]'s [ucstr(%q<chan>)] Channels until [convsecs(%q<until>)].;@check match(get(%q<g1>/CHANNEl`%q<chan>),%:)=@attach %!/INC`MSG=ERROR: Not joined to the channel!;@stop get(%#/D`GROUp`%q<g1>`GAG`%q<chan>)=@attach %!/INC`MSG=ERROR: Cannot use a channel while gagging it.;@stop strmatch(left(%0,1),|)=@attach %!/INC`MSG=ERROR: The Emit feature is disabled.};th u(setq,markup,u(markup,%0,setunion(u(setr,lwhoid,u(lwhoid)),get(%q<g1>/MEMBERS))));@check words(u(setr,list,u(filter,CHANLISTEN,%q<lwhoid>,%b,%b,%q<g1>,%q<chan>,%2,get(%q<g1>/CHANNEL`%q<chan>))));@attach %!/INC`CODE`CHAT`%va;@select/inline not(%2)=1,{@attach %!/INC`CODE`CHANLOG=%q<g1>,switch(%q<chan>,IC,1,OOC,2),%3,%#,get(%#/D`GROUP`%q<g1>`TITLE),get(%#/D`GROUP`%q<g1>`CODENAME),%q<markup>}
&INC`CODE`CHAT`PENNMUSH [u(cobj,group)]=@message %q<list>=%0,%!/FUN`CHATFORMAT,##,%#,%q<markup>,%q<chan>,%2,%q<g1>,,,%3,%q<lwhoid>
&INC`CODE`CHAT`RHOSTMUSH [u(cobj,group)]=@pemit/list %q<list>=udefault(FUN`CHATFORMAT,%0,##,%#,%q<markup>,%q<chan>,%2,%q<g1>,,,%3,%q<lwhoid>)
&FIL`CHANLISTEN [u(cobj,group)]=if(%3,cor(u(isadmin,%0),cand(get(%0/D`GROUP`%1`RANK),lte(get(%0/D`GROUP`%1`RANK),default(%1/SET`SYSALERT,3)))),cand(match(%4,%0),not(get(%0/D`GROUP`%1`GAG`%2))))
&INC`CODE`CHANLOG [u(cobj,group)]=@attach %!/INC`DOSQL=INSERT`CHANLOG,objid(%0),name(%0),%1,t(%2),objid(%3),name(%3),%4,%5,%6
&Q`INSERT`CHANLOG [u(Cobj,group)]=INSERT INTO vol_messages (message_date_created,source_objid,source_name,message_type,message_emit,speaker_objid,speaker_name,speaker_title,speaker_codename,message_contents) VALUES (UTC_TIMESTAMP(),?,?,?,?,?,?,?,?,?)
&GRP`GCHANNEL`RECALL [u(cobj,group)]=@attach %!/INC`TARGET;@attach %!/INC`VALID`GCHANNEL=%0;@attach %!/GRP`GCHANNEl`RECALL`START=%1
&GRP`GCHANNEl`RECALL`START [u(cobj,group)]=th u(setq,lwhoid,u(lwhoid));@select/inline u(valnum,%0)=1,{th u(setq,amt,%0)},{th u(setq,amt,10)};@pemit %#=u(header,%q<g1name> [ucstr(%q<chan>)] Log);@dolist u(setr,total,revwords(u(mysql,SELECT`RECALL_IDS,switch(%q<chan>,IC,1,OOC,2),objid(%q<g1>),%q<amt>)))={th u(setq,data,u(mysql3,SELECT`RECALL,##));@pemit %#=%[[u(fancytime,u(elements,%q<data>,1,u(fsep)),%#)]%] [u(FUN`CHATFORMAT,%#,u(elements,%q<data>,3,u(fsep)),u(elements,%q<data>,4,u(fsep)),%q<chan>,get(%q<g1>/##`TYPE),%q<g1>,1,,u(elements,%q<data>,2,u(fsep)),%q<lwhoid>)];@select/inline eq(words(%q<total>),#@)=1,{@pemit %#=u(FOOTER)}}
&Q`SELECT`RECALL_IDS [u(cobj,group)]=SELECT message_id FROM vol_messages WHERE message_type=? AND source_objid=? ORDER BY message_date_created DESC LIMIT ?
&Q`SELECT`RECALL [u(cobj,group)]=SELECT UNIX_TIMESTAMP(message_date_created),message_emit,speaker_objid,message_contents FROM vol_messages WHERE message_id=?
&FUN`CHATFORMAT [u(cobj,group)]=if(cor(%6,%8),,switch(1,hasflag(%0,PARANOID),%[[name(%1)]%(%1%)%],hasflag(%0,NOSPOOF),%[[name(%1)]:%]))[ansi(c,<)][ansi(u(strfirstof,u(groupcolor,%0,%5),get(%5/SET`COLOR),hx),u(getmoniker,%5))][if(cand(%4,not(%8)),ansi(c,-)[switch(%4,2,REPORT,SYS)],switch(%3,OOC,ansi(c,-)[ansi(r,ucstr(%3))],IC,))][ansi(c,>)]%B[if(cor(%4,%8),u(colormarkup,%0,%2),if(get(%5/SET`CHANNELRANK),\[[u(strfirstof,u(FUN`GETRANK,%5,%1),?)]\]%B)[if(strlen(get(%1/D`GROUP`%5`TITLE)),get(%1/D`GROUP`%5`TITLE)%B)][u(speech,%1,u(colormarkup,%0,%2),%0,%7,GROUPS,%9)])]
@@ &CMD`CHAT`PENNMUSH [u(cobj,group)]=$^(?s)(-|=)(\w+)?(?\:/(\S+)?)?(?\: +(.+))?$:@attach %!/CMD`CHAT`MAIN
@set [u(cobj,group)]/CMD`CHAT`PENNMUSH=regexp
@@ &CMD`CHAT`RHOSTMUSH [u(cobj,group)]=$^(?s)(-|=)(\\w+)?(?\:/(\\S+)?)?(?\: +(.+))?$:@attach %!/CMD`CHAT`MAIN
@set [u(cobj,group)]/CMD`CHAT`RHOSTMUSH=regexp
&CMD`CHAT`MAIN [u(cobj,group)]=th u(setq,chan,switch(%1,-,IC,=,OOC));@attach %!/INC`PARTIAL=%3,GAG|UNGAG|JOIN|LEAVE|RECALL,|,switch;@select/inline strlen(%q<switch>)=>0,{@attach %!/INC`FINDGROUP=u(strfirstof,%2,get(%#/D`GROUP)),1;@attach %!/GRP`GCHANNEL`%q<switch>`START=%4},{@check isdbref(u(setr,g1,u(namegrab,u(filter,ONCHANNEL,u(FUN`LISTGROUPS,%:),%b,%b,%:,switch(%1,-,IC,=,OOC,OOC)),u(strfirstof,%2,get(%#/D`GROUP)))))=@attach %!/INC`MSG=ERROR: Group not found!;@attach %!/INC`LOADGROUP=%q<g1>,1;@check strlen(%4)=@pemit %#=What will you say?;@attach %!/INC`CODE`CHAT=%4,switch(%1,-,IC,=,OOC,OOC),0}
@set [u(cobj,group)]/CMD`CHAT`[u(choosegame,RHOSTMUSH,PENNMUSH)]=no_command
&FIL`ONCHANNEL [u(cobj,group)]=t(match(get(%0/CHANNEL`%2),%1))
@@ MAINTENANCE
&PLAYER`CONNECT [u(cobj,group)]=@dolist u(lattr,%!/PLAYER`CONNECT`*)={@trigger %!/##=%0,%1,%2,%3,%4,%5,%6,%7,%8,%9}
&PLAYER`DISCONNECT [u(cobj,group)]=@dolist u(lattr,%!/PLAYER`DISCONNECT`*)={@trigger %!/##=%0,%1,%2,%3,%4,%5,%6,%7,%8,%9}
&OBJECT`DESTROY [u(cobj,group)]=@dolist u(lattr,%!/OBJECT`DESTROY`*)={@trigger %!/##=%0,%1,%2,%3,%4,%5,%6,%7,%8,%9}
&PLAYER`CONNECT`GROUPCHECK [u(cobj,group)]=@wait 2=@dolist u(filter,INVITES,u(FUN`LISTGROUPS,%0),%b,%b,%0)={@attach %!/INC`MSG=The [name(%i0)] have invited you to join their group! To accept\, type [u(pueblize,ansi(h,+gjoin [name(%i0)]),+gjoin [name(%i0)])]}
&OBJECT`DESTROY`CLEANUP [u(cobj,group)]=@select/inline %2=PLAYER,{@dolist/inline u(filter,ISGROUPMEMBER,u(FUN`LISTGROUPS),%B,%B,%0)={@attach %!/GRP`GMEMBER`KICK`DO=%i0,%0}}
&FIL`ISGROUPMEMBER [u(cobj,group)]=match(get(%0/MEMBERS),%1)
&FIL`ISGROUPMEMBER_OR_ADMIN [u(cobj,group)]=cor(u(isadmin,%1),u(FIL`ISGROUPMEMBER,%0,%1))
@@ HELP FILES
@@ COMMUNITY - GROUPS
&HLP`DIVISIONS [u(cobj,group)]=Divisions are groups within a group. Codedly they are simply extra labels to help with organizing members. Divisions have no extra permissions, and ranks are completely for show.%R%R[ansi(hc,Administrating Divisions)]%RThis requires the Manage permission.%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+dadmin/create <name>)] - Creates a new division.%R[ansi(h,+dadmin/rename <#>=<new name>)] - Renames a division.%R[ansi(h,+dadmin/disband <division name or #>)] - Delete a division.%R[ansi(h,+drank/create <div>/<ranknumber>=<name>)] - Adds a new rank to a Division.%R[ansi(h,+drank/delete <div>/<rank>)] - Removes a rank if unused.%R[ansi(h,+drank/rename <div>/<rank>=<newname>)] - Renames a division rank.%R[ansi(h,+dmember/add <div>/<player>)] - Add a player to <Division.>%R[ansi(h,+dmember/kick <div>/<player>)] - Remove a player from <division.>%R[ansi(h,+dmember/rank <division>/<player>=<#>)] - Sets a player's rank in <division.>)]%R%R[ansi(hc,Member Commands)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+divisions)] - Show all Divisions.%R[ansi(h,+drank <division>)] - Display Rank information for <division>.)]
+help/addsub Groups/Divisions=[u(cobj,group)]/HLP`DIVISIONS
&HLP`CHANNELS [u(cobj,group)]=Groups have both IC and OOC softcoded channels that work much like normal @channels.%R%RNote: +gradio is an alias for +gic%R%R[ansi(hc,Basic Commands)]Note: These are presented with +gooc as an example but +gic and +gradio work the same!%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gooc/join)] - Joins the Channel.%R[ansi(h,+gooc/leave)] - Leaves the channel.%R[ansi(h,+gooc/gag)] - Stop receiving Channel messages. resets on logout. Reversed with /ungag%R%R[ansi(hc,Moderator Commands)]%RMuzzled players cannot use a group's channels for a set duration.%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gooc/muzzle)] - Show all muzzled players.%R[ansi(h,+gooc/muzzle <player>=<duration>)] - Muzzles a player from group channels. Set Duration to 0 to unmuzzle/clear.)])]%R%R[ansi(hc,Sending Messages)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+gemit <ic/ooc>=<message>)] - Send a sourceless message on the channel. GEMIT permission required.%R[ansi(h,+gooc <speech>)] - speaks over the group's OOC channel.%R[ansi(h,+gic <speech>)] - Speaks over the group's IC channel.%R%R[ansi(h,=<group> <speech>)] - Shortcut for a specific group's OOC channels.%R[ansi(h,-<group> <speech>)] - Shortcut for a group's IC channels.%R%R<group> must be a single word in this usage. The command performs partial matching based on what groups you are a member of and haven't disabled reception for. You may also use the /gag\, /ungag\, /on\, and /off switches with it. Extra filtering is not performed if using a switch!%R%R[ansi(h,+gooc/recall <#>)] - recall a number of lines of previous chat\, similar to @chan/recall.)]
+help/addsub Groups/Channels=[u(cobj,group)]/HLP`CHANNELS
&Q`UPDATE`ABBR [u(cobj,group)]=UPDATE vol_group SET group_abbr=? WHERE group_id=?
&HLP`LOCKS [u(Cobj,group)]=Raw @lock system strings are tricky to work with. Utilizing the Group System, you can easily generate complex lockstrings from nothing more than a short list of group names.%R%R[ansi(hc,Concepts)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,GROUP)] - Check out +help Group.%R[ansi(h,ENTRY)] - An Entry is a visible Group's name which may optionally be followed by either a /<RANK> or /<permission> specification. Without a Specifier the system assumes 'rank 9001 or better'\, effectively 'anyone in the group.'%R[ansi(h,SPECIFICATION \(RANK\))] - Specifying a /# after the Entry will change it to that rank. For example: JusticeLeague/2 means only the leader and second-in-command pass the lock.%R[ansi(h,SPECIFICATION \(PERMISSIONS\))] - /PERM. For instance Earth Federation/MANAGE links it to anyone with that Permission\, including custom ones created with +gperm/create. Group membership is not checked.%R[ansi(h,DELIMITER)] - LockGroup rules can be aggregated using the pipe character | to string them together. Example: JusticeLeague/5|Earth's Special Forces/SHENLONG|Federation. | is the DELIMITER. In this case\, the | is a BOOLEAN 'OR' condition. The generated lock will be passed if ANY of those three ENTRIES are satisfied.)]%R%R[ansi(hc,Commands)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+lockgen <entries>)] - Generates and outputs a @lock <key> you can use to lock exits\, rooms\, command usage\, whatever.%RWhen systems use locks\, /lock will default to this system. Such as +radio/lock. If you want to specify hardcode-style @locks use /rawlock.)]
+help/add Technical/LockGen=[u(cobj,group)]/HLP`LOCKS
&CMD`LOCKGEN [u(cobj,group)]=$+lockgen *:@attach %!/INC`VALID`GROUPLOCK=%0,1;@attach %!/INC`MSG=GENERATED KEY: %q<value>;@attach %!/INC`MSG=MEANING: %q<valueformat>