-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathInfo Files - INFO.txt
executable file
·81 lines (47 loc) · 12.8 KB
/
Info Files - INFO.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
@@ DEPENDENCIES - CORE
th u(NEWCOBJ,Info Management System <INFO>,info,,,,WIZARD SAFE !NO_COMMAND,INHERIT SIDEFX SAFE)
&CMD`+INFO`PENNMUSH [u(cobj,info)]=$^(?s)(?\:\+)?(info|pinfo)(?\:/(\S+)?)?(?\: +(.+?))?(?\:/(.+?))?(?\:=(.*))?$:@attach %!/CMD`+INFO`MAIN
@set [u(cobj,info)]/CMD`+INFO`PENNMUSH=regexp
&CMD`+INFO`RHOSTMUSH [u(cobj,info)]=$^(?s)(?\:\+)?(info|pinfo)(?\:/(\\S+)?)?(?\: +(.+?))?(?\:/(.+?))?(?\:=(.*))?$:@attach %!/CMD`+INFO`MAIN
@set [u(cobj,info)]/CMD`+INFO`RHOSTMUSH=regexp
&CMD`+INFO`MAIN [u(cobj,info)]=@attach %!/INIT`%1;@attach %!/INC`GETSWITCH=%2;@attach %!/INC`[u(strfirstof,%q<switch>,MAIN)]=trim(%3),trim(%4),%5
@set [u(cobj,info)]/CMD`+INFO`[u(choosegame,RHOSTMUSH,PENNMUSH)]=no_command
&SWITCHES`PLAYER [u(cobj,info)]=GET|RENAME|DELETE|SUMMARY
&SWITCHES`ADMIN [u(cobj,info)]=LOCK|UNLOCK|LSET
&SYSTEM`NAME [u(cobj,info)]=u(strfirstof,%q<sysname>,INFO)
&INIT`INFO [u(cobj,info)]=th u(setq,sysname,INFO);th u(setq,root,1);th u(setq,private,0);th u(setq,comm,+info);th u(setq,summary,0)
&INIT`PINFO [u(cobj,info)]=th u(setq,sysname,PINFO);th u(setq,root,2);th u(setq,private,1);th u(setq,comm,+pinfo);th u(setq,summary,0)
&INC`MAIN [u(cobj,info)]=@select/inline strlen(%2)=>0,{@attach %!/INC`SET},{@attach %!/INC`VIEW}
&INC`TARGET [u(cobj,info)]=@select/inline t(strlen(%0))[t(strlen(%1))]=10,{@select/inline isdbref(u(setr,target,pmatch(%0)))=1,{@attach %!/INC`CHECKPC=%q<target>,1;th u(setq,filename,%1)},0,{@attach %!/INC`CHECKPC=%#,1;th u(setq,target,%#);th u(setq,filename,%0)}},00,{th u(setq,target,%#);@attach %!/INC`CHECKPC=%#,1},11,{@attach %!/INC`CHECKPC=%0,1;th u(setq,filename,%1);th u(setq,target,%q<t1>)};th u(setq,filename,iter(%q<filename>,trim(%i0),|,|))
&INC`LOADFILE [u(cobj,info)]=th u(setq,infoload,u(mysql3,LOAD`INFOFILE,u(setr,i%1,%0)));th iter(type name modified ownerid ownername ownerobjid lockerid lockername lockerobjid lockdate authorname authorobjid,u(setq,i%1%i0,u(elements,%q<infoload>,inum(0),u(fsep))))
&Q`FIND`INFOFILE [u(cobj,info)]=SELECT info_id FROM volv_infofile WHERE owner_id=? AND info_type=? AND info_name LIKE '!%%' ORDER BY info_name LIMIT 1
&Q`LOAD`INFOFILE [u(cobj,info)]=SELECT info_type,info_name,info_date_modified_secs,owner_id,owner_name,owner_objid,locker_id,locker_name,locker_objid,locked_date_secs,author_name,author_objid FROM volv_infofile WHERE info_id=?
&INC`FINDFILE [u(cobj,info)]=@check strlen(%0)=@attach %!/INC`MSG=ERROR: Info name empty.;@check isint(u(setr,field_id,u(mysql,FIND`INFOFILE,get(%q<target>/D`ID),%q<root>,sqlescape(%0))))=@attach %!/INC`MSG=ERROR: '%0' not found.;@attach %!/INC`LOADFILE=%q<field_id>,1;
&INC`LOCK [u(cobj,info)]=@attach %!/INC`TARGET;@check strlen(%q<filename>)=@attach %!/INC`MSG=ERROR: Info name empty.;@dolist/inline/nobreak/delimit | %q<filename>={@attach %!/INC`FINDFILE=u(choosegame,%i0,%d0);@stop %q<i1lockerid>=@attach %!/INC`MSG=ERROR: [u(capnames,%q<sysname>)] File %q<i1name> is already Locked!;@attach %!/INC`DOSQL=LOCK`FILE,%q<i1>,get(%#/D`ID);@select/inline %q<target>=%#,{@attach %!/INC`MSG=You Locked your %q<iname> [u(capnames,%q<sysname>)] File},{@attach %!/INC`MSG=You Locked [name(%q<target>)]'s %q<i1name> [u(capnames,%q<sysname>)] File!;@attach %!/INC`MSG`NOTICE=Your %q<i1name> [u(capnames,%q<sysname>)] File was locked.,%q<target>};@attach %!/INC`MSG`CHAN=Locked %q<t1name>'s %q<i1name> [u(capnames,%q<sysname>)] File.}
&INC`UNLOCK [u(cobj,info)]=@attach %!/INC`TARGET;@attach %!/INC`FILENAME;@check strlen(%q<filename>)=@attach %!/INC`MSG=ERROR: Info name empty.;@dolist/inline/nobreak/delimit | %q<filename>={@attach %!/INC`FINDFILE=u(choosegame,%i0,%d0);@check %q<i1lockerid>=@attach %!/INC`MSG=ERROR: [u(capnames,%q<sysname>)] File %q<i1name> is not Locked!;@attach %!/INC`DOSQL=UNLOCk`FILE,%q<i1>;@select/inline %q<target>=%#,{@attach %!/INC`MSG=You Unlocked your %q<i1name> Info File},{@attach %!/INC`MSG=You Unlocked [name(%q<target>)]'s [u(capnames,%q<sysname>)] File %q<i1name>!;@attach %!/INC`MSG`NOTICE=Your [u(capnames,%q<sysname>)] File %q<i1name> was unlocked.};@attach %!/INC`MSG`CHAN=Unlocked %q<t1name>'s %q<i1name> [u(capnames,%q<sysname>)] File.}
&Q`UNLOCK`FILE [u(cobj,info)]=DELETE FROM vol_field_lock WHERE field_id=?
&INC`DELETE [u(cobj,info)]=@attach %!/INC`TARGET;@check strlen(%q<filename>)=@attach %!/INC`MSG=ERROR: Info name empty.;@dolist/inline/delimit | %q<filename>={@attach %!/INC`FINDFILE=u(choosegame,%i0,%d0);@select/inline cor(strmatch(%#,%q<target>),u(isadmin,%#))=0,{@stop 1=@attach %!/INC`MSG=ERROR: You may not delete another's Info files.};@stop cand(cor(%q<i1lockerid>,cand(%q<lockapprove>,u(approved,%q<target>))),not(u(isadmin,%#)))=@attach %!/INC`MSG=ERROR: Locked Files must be Unlocked by admin first.;@attach %!/INC`DOSQL=DELETE`FILE,%q<i1>;@select/inline %q<target>=%#,{@attach %!/INC`MSG=You deleted your [u(capnames,%q<sysname>)] File %q<i1name>},{@attach %!/INC`MSG=You deleted [name(%q<target>)]'s [u(capnames,%q<sysname>)] File %q<i1name>!;@attach %!/INC`MSG`NOTICE=Your [u(capnames,%q<sysname>)] File %q<i1name> was deleted.,%q<target>}}
&Q`DELETE`FILE [u(cobj,info)]=DELETE FROM vol_field WHERE field_id=?
&INC`GET [u(cobj,info)]=@attach %!/INC`TARGET;@dolist/inline/nobreak/delimit | %q<filename>={@attach %!/INC`FINDFILE=u(choosegame,%i0,%d0);@pemit %#=u(HEADER,Unformatted Contents of %q<iname>);@pemit %#=u(decompose,u(mysql,VIEW`FILE,%q<i1>));@pemit %#=u(FOOTER)}
&INC`VIEW [u(cobj,info)]=@attach %!/INC`TARGET;@select/inline %q<private>=1,{@check cor(strmatch(%#,%q<target>),u(isadmin,%#))=@attach %!/INC`MSG=ERROR: %q<sysname> files are private.};@select/inline gt(strlen(%q<filename>),0)=1,{@attach %!/INC`VIEW`CONTENTS},0,{@attach %!/INC`VIEW`FILES}
&INC`VIEW`FILES [u(cobj,info)]=@pemit %#=u(HEADER,%q<t1name>'s [u(capnames,%q<sysname>)] Files);@pemit %#=u(table,iter(u(mysql3,VIEW`NAMES,get(%q<target>/D`ID),%q<root>),u(mxpmenu,left(u(setr,fname,u(elements,%i0,1,u(fsep))),26),%q<comm> [u(setr,get,%q<t1name>/%q<fname>)]|%q<comm>/get %q<get>,View|Decompile)[if(u(elements,%i0,2,u(fsep)),\([ansi(hw,+)]\))],u(rsep),u(rsep)),24,u(width,%#),u(rsep));@pemit %#=u(FOOTER,Legend: + - Locked)
&Q`VIEW`NAMES [u(cobj,info)]=SELECT info_name,locker_id FROM volv_infofile WHERE owner_id=? AND info_type=? ORDER BY info_name
&INC`VIEW`CONTENTS [u(cobj,info)]=@dolist/inline/nobreak/delimit | %q<filename>={@attach %!/INC`FINDFILE=u(choosegame,%i0,%d0);@pemit %#=u(HEADER,%q<t1name>'s +[lcstr(%q<sysname>)]: %q<i1name>);@select/inline cand(%q<summary>,strlen(u(setr,sum,u(mysql,VIEW`SUMMARY,%q<i1>))))=1,{@pemit %#=%q<sum>;@pemit %#=u(separator)};@pemit %#=u(mysql,VIEW`FILE,%q<i1>);@select/inline u(isadmin,%#)=1,{@pemit %#=u(separator,Admin Info);@pemit %#=[ansi(h,Last set by:)] %q<i1authorname> [ansi(h,On:)] [u(fancytime,%q<i1modified>)][if(%q<i1lockerid>,%R[ansi(h,Locked by:)] %q<i1lockername> [ansi(h,On:)] [u(fancytime,%q<i1lockdate>)])]};@pemit %#=u(SUBHEADER,if(%q<i1lockerid>,Admin Locked File))}
&Q`VIEW`FILE [u(cobj,info)]=SELECT field_text FROM vol_field WHERE field_id=?
&Q`VIEW`SUMMARY [u(cobj,info)]=SELECT field_text_summary FROM vol_field WHERE field_id=?
&INC`LSET [u(cobj,info)]=@attach %!/INC`SET=%0,%1,%2,1
&Q`FIND`EXACT [u(cobj,info)]=SELECT info_id FROM volv_infofile WHERE owner_id=? AND info_type=? AND info_name=? ORDER BY info_name LIMIT 1
&INC`VALID`FILENAME [u(cobj,info)]=@check strlen(u(setr,filename,trim(stripansi(%0))))=@attach %!/INC`MSG=Filename field empty!;@stop gt(strlen(%q<filename>),26)=@attach %!/INC`MSG=ERROR: %q<sysname> files are limited to 26 characters.;@stop u(charsearch,%q<filename>,u(badchars) /)=@attach %!/INC`MSG=ERROR: Filenames may not contain: [v(badchars)] /;@stop cand(u(setr,found_file,u(mysql,FIND`EXACT,get(%q<target>/D`ID),%q<root>,%q<filename>)),not(eq(%q<found_file>,%1)))=@attach %!/INC`MSG=ERROR: File name is already in use.
&INC`PREPARE_SET [u(cobj,info)]=@attach %!/INC`TARGET;@stop cand(isdbref(pmatch(%0)),not(strlen(%1)))=@attach %!/INC`MSG=ERROR: '%0' matches player [name(%q<target>)]. Use <name>/<filename> format to be more explicit.;@check strlen(%q<filename>)=@attach %!/INC`MSG=ERROR: File name empty.;@select/inline u(setr,field_id,u(mysql,FIND`EXACT,get(%q<target>/D`ID),%q<root>,%q<filename>))=>0,{@check cor(strmatch(%#,%q<target>),u(isadmin,%#))=@attach %!/INC`MSG=ERROR: You may not change another's [u(capnames,%q<sysname>)] files.;@attach %!/INC`LOADFILE=%q<field_id>,1;@select/inline cor(%q<i1lockerid>,cand(%q<lockapprove>,u(approved,%q<target>)))=1,{@check u(isadmin,%#)=@attach %!/INC`MSG=ERROR: That File may not be changed by you.}},{@stop cand(%q<lockapprove>,u(approved,%q<target>),not(u(isadmin,%#)))=@attach %!/INC`MSG=ERROR: Cannot create files post-approval.};@attach %!/INC`VALID`FILENAME=%q<filename>,%q<field_id>;
&INC`SET [u(cobj,info)]=@attach %!/INC`PREPARE_SET;@attach %!/INC`FINISH_SET=%0,%1,%2,%3,0,File
&INC`SUMMARY [u(cobj,info)]=@check t(%q<summary>)=@attach %!/INC`MSG=ERROR: Summary is disabled for [u(capnames,%q<sysname>)] Files.;@attach %!/INC`PREPARE_SET;@attach %!/INC`FINISH_SET=%0,%1,%2,%3,1,Summary
&INC`FINISH_SET [u(cobj,info)]=@check strlen(%2)=@attach %!/INC`MSG=ERROR: %5 field empty. To delete a file use %q<comm>/delete.;@check u(setr,results,u(call`5,volp_field[if(%4,_summary)],0,get(%q<target>/D`ID),%q<root>,'[sqlescape(%q<filename>)]','[sqlescape(%2)]',get(%#/D`ID)))=@attach %!/INC`MSG=ERROR: Could not set %q<sysname>. Reason: %q<results>;@select/inline %4=0,{@attach %!/INC`DOSQL=RENDER`FILE,u(RENDER,%2),%q<results>;@select/inline %3=1,{@attach %!/INC`DOSQL=LOCK`FILE,%q<results>,get(%#/D`ID)}};@select/inline %q<target>=%#,{@attach %!/INC`MSG=You [if(%3,lock-)]set your %q<filename> [u(capnames,%q<sysname>)] %5},{@attach %!/INC`MSG=You [if(%3,lock-)]set %q<t1name>'s [u(capnames,%q<sysname>)] %5 %q<filename>!;@attach %!/INC`MSG`NOTICE=Your [u(capnames,%q<sysname>)] %5 %q<filename> was [if(%3,lock-)]set.,%q<target>}
&Q`RENDER`FILE [u(cobj,info)]=UPDATE vol_field SET field_text_render=? WHERE field_id=?
&Q`LOCK`FILE [u(cobj,info)]=INSERT INTO vol_field_lock (field_id,locker_id,locked_date) VALUES (?,?,UTC_TIMESTAMP()) ON DUPLICATE KEY UPDATE locker_id=VALUES(locker_id),locked_date=VALUES(locked_date)
&INC`RENAME [u(cobj,info)]=@attach %!/INC`TARGET;@attach %!/INC`FINDFILE=%q<filename>,1;@attach %!/INC`VALID`FILENAME=%2,%q<i1>;@attach %!/INC`DOSQL=RENAME`FILE,%q<filename>,%q<i1>;@select/inline %q<target>=%#,{@attach %!/INC`MSG=File named to '%q<filename>'!},{@attach %!/INC`MSG=You renamed %q<t1name>'s %q<i1name> [u(capnames,%q<sysname>)] File to %q<filename>;@attach %!/INC`MSG`NOTICE=Your [u(capnames,%q<sysname>)] File %q<iname> was renamed to %q<filename>,%q<target>}
&Q`RENAME`FILE [u(cobj,info)]=UPDATE vol_field SET field_name=? WHERE field_id=?
@@ CHARACTER - +INFO
&HLP`+INFO [u(cobj,info)]=The Info system allows Players to store notes about their character. These notes can be used for a number of things, such as tracking details of resources, backgrounds, cheat sheets, or other notes that might be several paragraphs in length. Anything stored in +info is visible to ALL PLAYERS. If you want private files, use +pinfo (the commands are the same.)%R%R[ansi(hc,Concepts)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,infonames)] - Info files can't be very long\, may not contain special characters\, and are not case sensitive.%R[ansi(h,filelists)] - Some commands let you specify a list of files. Seperate their names with | symbols\, such as file1|file2.%R[ansi(h,locked)] - Locked files have been verified by staff and are read-only.)]%R%R[ansi(hc,Managing Infos)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+info <infoname>=<text>)] - Creates or replaces an info file.%R[ansi(h,+info/delete <filelist>)] - Deletes a file or series of files.%R[ansi(h,+info/rename <infoname>=<newname>)] - Renames Info files.)]%R%R[ansi(hc,Viewing Infos)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+info)] - Show all of your Info files.%R[ansi(h,+info <filelist>)] - Display an info's contents.%R[ansi(h,+info <player>)] - Show a player's visible files.%R[ansi(h,+info <player>/<filelist>)] - Display a player's info contents.%R%RUse the /get switch as you would reading files to retrieve a decompile'd version for easy editing.%R%RIf your File name matches a player's\, you will have to use +info <yourname>/<filename> to set or view it.)]
+help/add Character/+info=[u(cobj,info)]/HLP`+INFO
&SHLP`+INFO [u(cobj,info)]=Staff are able to see, create, edit, delete, rename, and otherwise manage +info and +pinfo files on any character. The commands work the same as for players via <name>/<filename>.%R%R[ansi(hc,Staff Commands)]%R[align(5 [sub(u(width,%#),6)],,[ansi(h,+info/lock <player>/<filelist>)] - Lock one or more info files.%R[ansi(h,+info/unlock <player>/<filelist>)] - Unlock one or more info files.%R[ansi(h,+info/lset <player>/<file>=<contents>)] - Works just like setting an +info file but locks it simultaneously.%R%RLocked files cannot be edited by players. This is useful for 'approved information' depending on the game.)]
+shelp/add Character/+info=[u(cobj,info)]/SHLP`+INFO