-
Notifications
You must be signed in to change notification settings - Fork 0
/
Theme System.txt
80 lines (47 loc) · 11.1 KB
/
Theme System.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
@@ Dependencies: Info Files
@skip isdbref(tag(setr(1,theme)))={@assert/inline isdbref(globalroom())=@pemit %#=ERROR: No global room set!;@assert/inline isdbref(setr(0,create(Theme System,,t)))=@pemit %#=ERROR: Could not create code object %q1: %q0;@set %q0=INDESTRUCTIBLE !NO_COMMAND;@tag/add %q1=%q0;@tel %q0=[globalroom()];@parent %q0=#info_lib}
&CMD.@THEME #theme=$^(?s)(?\:@|\+)?(theme|world|origin|tinfo)(?\:/(\\S+)?)?(?\: +(.+?))?(?\:/(.+?))?(?\:=(.*))?$:@if strmatch(%1,tinfo)={@attach %!/DO_INFO},{@attach #inc/GET_SWITCH=%2,THEME;@attach %!/SW.THEME.[strfirstof(%q<switch>,MAIN)]=trim(%3),trim(%4),%5}
@set #theme/CMD.@THEME=regexp
&INFO.ATTR #theme=THEME
&INFO.NAME #theme=Theme
&INFO.PLURAL #theme=Theme Data
&INFO.CMD #theme=+TINFO
&SWITCHES.THEME.0 #theme=CREATE|RENAME|DESCRIBE|GET|TRANSFER|GRANT|REVOKE
&SWITCHES.THEME.5 #theme=APPROVE|UNAPPROVE|ADD|REMOVE
&FN.THEMES #theme=sortname(lcon(%!,OBJECT,,,1))
&FN.FINDEXACT #theme=namefind(u(FN.THEMES),%0)
&FN.FINDTHEME #theme=namegrab(u(FN.THEMES),%0)
&FN.ISADMIN #theme=match(setunion(get(%0/OWNER),get(%0/ADMINS)),objid(%1))
&FN.VALID_THEME_NAME #theme=ofparse(3,if(strlen(%0),1,#-1 NO NAME ENTERED),if(contains_character(%0,/),#-1 THEME NAMES CANNOT HAVE A / IN THEM SORRY Fate/Stay Night AND .hack//GU),if(valid(name,%0),1,#-1 THAT'S NOT A GOOD NAME FOR A THING OBJECT. TRY FEWER SPECIAL CHARACTERS),1)
&SW.THEME.CREATE #theme=@skip gtebittype(%#,2)={@break/inline isapproved(%#)=@pemit %#=You are approved and have no business creating a theme!;@break/inline isobjid(get(%#/GAME.THEME))=@pemit %#=You are already bound to a theme! No need for another.};@assert/inline setr(!,u(FN.VALID_THEME_NAME,stripansi(%0)),res)=@pemit %#=%q<res>;@assert/inline isdbref(setr(!,create(stripansi(%0),,t),theme))=@pemit %#=%q<theme>;th setq(!,objid(%q<theme>),theme);@if has_markup(%0)={@name/ansi %q<theme>=%0},{@name %q<theme>=%0};@set %q<theme>=INDESTRUCTIBLE;@pemit %#=Theme created!;@attach #inc/MSG_ALERT=Created Theme: %0;@if !isapproved(%#)={@set %q<theme>=OWNER:%:;@attach %!/DO_ADD=%q<theme>,%:}
&DO_ADD #theme=@set %0=MEMBERS:[sortname(setunion(filterobjid(get(%0/MEMBERS)),objid(%1)))];@set %1=GAME.THEME:[objid(%0)]
&DO_REMOVE #theme=@set %0=MEMBERS:[sortname(setunion(filterobjid(get(%0/MEMBERS)),objid(%1)))];@set %1=GAME.THEME:
@@ %0 - Theme Objid, %1 - member objid
&DO_DELETE #theme=@dolist/inline get(%0/MEMBERS)={@set %d0=GAME.THEME:};@set %0=!INDESTRUCTIBLE !SAFE;@destroy/override %0
&FINDTHEME #theme=@assert/inline strlen(%0)=@pemit %#=Nothing entered to find!;@assert/inline isobjid(setr(!,u(FN.FINDTHEME,%0),%1))=@pemit %#=Theme '%0' not found.
&SW.THEME.DELETE #theme=@attach %!/FINDTHEME=%0,theme;@assert/inline cor(gtebittype(%#,5),cand(u(FN.ISADMIN,%q<theme>,%:),!u(FIL.APPROVED,%q<theme>)))=@pemit %#=Permission denied.;@assert/inline match(%q<theme>|[cname(%q<theme>)],%2)=@pemit %#=Verification failed.;@pemit %#=Theme '[cname(%q<theme>)]' deleted.;@if u(FIL.APPROVED,%q<theme>)={@attach #inc/MSG_ALERT=Theme '[cname(%q<theme>)]' deleted.};@attach %!/DO_DELETE=%q<theme>
&SW.THEME.ADD #theme=@attach %!/FINDTHEME=%0,theme;@attach #inc/GET_PLAYER=%1,t1;@break/inline match(setr(!,filterobjid(get(%q<theme>/MEMBERS)),data),%q<t1>)=@pemit %#=[cname(%q<t1>)] is already a member of the theme!;@attach %!/DO_ADD=%q<theme>,%q<t1>;@pemit %#=Added [cname(%q<t1>)] to Theme '[cname(%q<theme>)]';@attach #inc/MSG_ALERT=Added [cname(%q<t1>)] to Theme '[cname(%q<theme>)]';@pemit %q<t1>=You've been added to Theme '[cname(%q<theme>)]'
&SW.THEME.REMOVE #theme=@attach %!/FINDTHEME=%0,theme;@attach #inc/GET_PLAYER=%1,t1;@assert/inline match(setr(!,filterobjid(get(%q<theme>/MEMBERS)),data),%q<t1>)=@pemit %#=[cname(%q<t1>)] is not a member of the theme!;@attach %!/DO_REMOVE=%q<theme>,%q<t1>;@pemit %#=Removed [cname(%q<t1>)] from Theme '[cname(%q<theme>)]';@attach #inc/MSG_ALERT=Removed [cname(%q<t1>)] from Theme '[cname(%q<theme>)]';@pemit %q<t1>=You've been removed from Theme '[cname(%q<theme>)]'
&SW.THEME.RENAME #theme=@attach %!/FINDTHEME=%0,theme;@assert/inline cor(gtebittype(%#,5),cand(u(FN.ISADMIN,%q<theme>,%:),!u(FIL.APPROVED,%q<theme>)))=@pemit %#=Permission denied.;@assert/inline setr(!,u(FN.VALID_THEME_NAME,stripansi(%1)),res)=@pemit %#=%q<res>;@break/inline words(setdiff(u(FN.FINDEXACT,stripansi(%2)),%q<theme>))=@pemit %#=Name conflict detected.;th setq(!,cname(%q<theme>),oldname);@if has_markup(%2)={@name/ansi %q<theme>=%2},{@name %q<theme>=%2};@pemit %#=Theme Renamed from '%q<oldname>' to '%2'.;@if u(FIL.APPROVED,%q<theme>)={@attach #inc/MSG_ALERT=Theme Renamed from '%q<oldname>' to '%2'.}
&SW.THEME.DESCRIBE #theme=@attach %!/FINDTHEME=%0,theme;@assert/inline cor(gtebittype(%#,5),cand(u(FN.ISADMIN,%q<theme>,%:),!u(FIL.APPROVED,%q<theme>)))=@pemit %#=Permission denied.;@describe %q<theme>=%2;@pemit %#=Theme '[cname(%q<theme>)]' description set.;@if u(FIL.APPROVED,%q<theme>)={@attach #inc/MSG_ALERT=Theme '[cname(%q<theme>)]' description set.}
&SW.THEME.GET #theme=@attach %!/FINDTHEME=%0,theme;@pemit %#=header(Theme: [cname(%q<theme>)]);@pemit %#=translate(get(%q<theme>/DESC),1);@pemit %#=footer()
&SW.THEME.GRANT #theme=@attach %!/FINDTHEME=%0,theme;@assert/inline cor(gtebittype(%#,5),strmatch(get(%q<theme>/OWNER),%:))=@pemit %#=Permission denied.;@attach #inc/GET_PLAYER=%1,t1;@break/inline match(setr(!,filterobjid(get(%q<theme>/ADMINS)),data),%q<t1>)=@pemit %#=[cname(%q<t1>)] is already an admin for the theme!;@set %q<theme>=ADMINS:[setunion(%q<data>,%q<t1>)];@pemit %#=Granted '[cname(%q<t1>)]' admin rights to Theme '[cname(%q<theme>)]';@pemit %q<t1>=You've been granted admin rights to Theme '[cname(%q<theme>)]'.;@if u(FIL.APPROVED,%q<theme>)={@attach #inc/MSG_ALERT=Granted '[cname(%q<t1>)]' admin rights to Theme '[cname(%q<theme>)]'}
&SW.THEME.REVOKE #theme=@attach %!/FINDTHEME=%0,theme;@assert/inline cor(gtebittype(%#,5),strmatch(get(%q<theme>/OWNER),%:))=@pemit %#=Permission denied.;@attach #inc/GET_PLAYER=%1,t1;@assert/inline match(setr(!,filterobjid(get(%q<theme>/ADMINS)),data),%q<t1>)=@pemit %#=[cname(%q<t1>)] is not an admin for the theme!;@set %q<theme>=ADMINS:[setdiff(%q<data>,%q<t1>)];@pemit %#=Revoked '[cname(%q<t1>)]' admin rights to Theme '[cname(%q<theme>)]';@pemit %q<t1>=Your admin rights to Theme '[cname(%q<theme>)]' were revoked..;@if u(FIL.APPROVED,%q<theme>)={@attach #inc/MSG_ALERT=Revoked '[cname(%q<t1>)]' admin rights to Theme '[cname(%q<theme>)]'}
&SW.THEME.TRANSFER #theme=@attach %!/FINDTHEME=%0,theme;@assert/inline cor(gtebittype(%#,5),strmatch(get(%q<theme>/OWNER),%:))=@pemit %#=Permission denied.;@attach #inc/GET_PLAYER=%1,t1;@pemit %#=You transfer ownership of Theme '[cname(%q<theme>)]' to [cname(%q<t1>)].;@pemit %q<t1>=Ownership of Theme '[cname(%q<theme>)]' was transferred to you.;@attach #inc/MSG_ALERT=Transferred ownership of Theme '[cname(%q<theme>)]' to [cname(%q<t1>)].
&FIL.APPROVED #theme=default(%0/APPROVED,0)
&FN.THEME.LIST #theme=columns(iter(%0,cname(%i0),%b,|),26,3,l,1,1,,%b,,1,|,%B,1)
&DO.THEME.LIST #theme=@if words(%0)={@pemit %#=separator(%1);@pemit %#=u(FN.THEME.LIST,%0)}
&INC.THEME.LIST #theme=@assert/inline words(setr(!,u(FN.THEMES),all))=@pemit %#=No themes to list!;@pemit %#=header(Theme List);th setq(!,filter(FIL.APPROVED,%q<all>),approved);th setq(!,listdiff(%q<all>,%q<approved>),unapproved);@attach %!/DO.THEME.LIST=%q<approved>,Approved;@attach %!/DO.THEME.LIST=%q<unapproved>,Un-Approved;@pemit %#=footer(words(%q<all>) Total Themes)
&SW.THEME.APPROVE #theme=@attach %!/FINDTHEME=%0,theme;@break/inline u(FIL.APPROVED,%q<theme>)=@pemit %#=It is already approved!;@set %q<theme>=APPROVED:1;@pemit %#=Theme '[cname(%q<theme>)]' approved! Don't forget to lock relevant +tinfo files.;@attach #inc/MSG_ALERT=Theme '[cname(%q<theme>)]' approved!
&SW.THEME.UNAPPROVE #theme=@attach %!/FINDTHEME=%0,theme;@assert/inline u(FIL.APPROVED,%q<theme>)=@pemit %#=It is not approved!;@set %q<theme>=APPROVED:;@pemit %#=Theme '[cname(%q<theme>)]' un-approved!;@attach #inc/MSG_ALERT=Theme '[cname(%q<theme>)]' un-approved!
&FN.ROSTER.COLUMNS #theme=printf($-23s $11s,Name,LastOn/Idle)
&FN.ROSTER.ROW #theme=printf($-23s $11s,cname(%0),lastidle(%0))
&INC.THEME.DISPLAY #theme=@attach %!/FINDTHEME=%0,theme;@pemit %#=header(Theme: [cname(%q<theme>)]);@if strlen(setr(!,get(%q<theme>/DESCRIBE),desc))={@pemit %#=%q<desc>};@if words(setr(!,u(FN.LIST_FILENAMES,%q<theme>),files),|)={@pemit %#=separator(+tinfo Files);@pemit %#=columns(%q<files>,26,3,l,1,1,,%b,,1,|,%B,1)};@if words(setr(!,filterobjid(get(%q<theme>/MEMBERS)),mem))={@pemit %#=separator(Cast of Characters);@pemit %#=ansi(confoverride(%#,COLUMN),u(FN.ROSTER.COLUMNS));@dolist/inline %q<mem>={@pemit %#=u(FN.ROSTER.ROW,%d0,%q<theme>)}};@if or(isobjid(setr(!,get(%q<theme>/OWNER),owner)),words(setr(!,filterobjid(get(%q<theme>/ADMINS)),admin)))={@pemit %#=separator(Metadata);@if isobjid(%q<owner>)={@pemit %#=[ansi(hw,Owner/Founder:)]%B[cname(%q<owner>)]};@if words(%q<admins>)={@pemit %#[ansi(hw,Admins:)]%B[iter(%q<admins>,cname(%i0),%b,\,%b)]}};@pemit %#=footer()
&SW.THEME.MAIN #theme=@if strlen(%0)={@attach %!/INC.THEME.DISPLAY},{@attach %!/INC.THEME.LIST}
@@ +tinfo section
&INC.INFO.TARGET #theme=@attach %!/FINDTHEME=%0,target;th setq(!,%1,filename)
&INC.INFO.CANSET #theme=@assert/inline cor(gtebittype(%#,5),u(FN.ISADMIN,%q<target>,%:))=@pemit %#=Permission denied.
&INFO.ADMIN #theme=if(u(FIL.APPROVED,%q<target>),gtebittype(%0,2),t(match(get(%q<target>/OWNER)%B[get(%q<target>/ADMINS)],objid(%0))))
@@ Help stuff
+help/add Community/@theme=#theme/HLP_@THEME
&HLP_@THEME #theme=[ansi(hc,Aliases:)]%Btheme, +theme, @theme, world, +world, @world%R%RThe Theme system is used for tracking which World/Theme characters are from or share. It is used by multi-theme/crossover games which need to organize characters by their source material.%R%R[ansi(hc,Permissions)]%R%TWizards have unrestricted ability to create and modify themes. For ordinary players, it works like this: The creator of a theme is its OWNER, who may /grant or /revoke ADMINS to it or /transfer Ownership. ADMINS/The owner are able to modify the Description (while the theme is unapproved) and administrate its info files. Only Wizards may actually /add and /remove characters from themes.%R%R[ansi(hc,Administration Commands)]%R%R[ansi(hw,@theme/create <name>)]%R%TCreates a new theme. For new characters in chargen, this also /adds them to the theme and sets them as owner.%R%R[ansi(hw,@theme/describe <theme>=<name>)]%R%TSet the main description of a Theme.%R%R[ansi(hw,@theme/rename <theme>=<new name>)]%R%TRenames a theme.%R%R[ansi(hw,@theme/delete <theme>=<verify>)]%R%TDeletes a theme.%R%R[ansi(hw,@theme/grant <theme>=<player>)]%R%TGrants admin privileges.%R%R[ansi(hw,@theme/revoke <theme>=<player>)]%R%TRevokes admin privileges.%R%R[ansi(hw,@theme/transfer <theme>=<player>)]%R%TTransfer ownership of a theme.%R%R[ansi(hw,@theme/add <theme>=<player>)]%R%TAdd a character to a theme.%R%R[ansi(hw,@theme/remove <theme>=<player>)]%R%TRemove a character from a theme.%R%R[ansi(hc,Theme Info Files)]%RThemes support notes which use the handling as [ansi(hw,+info)] files. they are accessed using [ansi(hw,+tinfo)]. For instance, [ansi(hw,+tinfo <theme>/<file>)] would display a given file. These files are publically visible, but may be locked by admins against editing.