-
Notifications
You must be signed in to change notification settings - Fork 0
/
CORE 03 - Include Library.txt
63 lines (35 loc) · 6.72 KB
/
CORE 03 - Include Library.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
@@ CORE xx - Include Library
@cmdquota me=99999
@skip isdbref(tag(setr(1,inc)))={@assert/inline isdbref(tag(stor))=@pemit %#=ERROR: No storage object set!;@assert/inline isdbref(setr(0,create(Include Library,,t)))=@pemit %#=ERROR: Could not create Include Library: %q0;@set %q0=INDESTRUCTIBLE NO_COMMAND;@tag/add %q1=%q0;@tel %q0=#stor}
&MSG #inc=@pemit/list strfirstof(%1,%#)=%0
@@ %0 - Message. %1 - Recipients.
&MSG_ALERT #inc=@attach/localize #inc/MSG_ALERT_DO=%0,%1
&MSG_ALERT_DO #inc=th setq(!,[chr(91)][strfirstof(%1,cname(%!) - %!)][chr(93)]-[chr(91)]%k[chr(93)] %0,msg);@log [chr(91)][time()][chr(93)]-%q<msg>;@dolist/inline filter(#lambda/[lit(default(%0/ALERTS,1))],bitwho(globalconf(ALERTLEVEL)))={@pemit %d0=[chr(91)][runintz(gettz(%d0),time())][chr(93)]-%q<msg>}
&GET_PLAYER #inc=@assert/inline strlen(%0)=@pemit %#=You must enter a player name!;@assert/inline strlen(%1);@assert/inline isdbref(pmatchreg(%0,%1))=@pemit %#=%0 [if(strmatch(r(%1),#-2*),matches multiple players!,does not match a player!)];th setq(!,objid(r(%1)),%1)
@@ GET_PLAYER Arguments: %0 = player being checked, %1 = register number to load their data into.
&VALID.BASE #inc=@assert/inline strlen(setr(!,trim(%0),value))=@pemit %#=Nothing entered!
&VALID.EMAIL #inc=@attach #inc/VALID.BASE=%0;@assert/inline lte(strlen(%q<value>),255)=@pemit %#=Emails must be 255 characters or less.;@break/inline strmatch(%q<value>,* *)=@pemit %#=Email addresses may not contain spaces.;@assert/inline strmatch(%q<value>,*@*.*)=@pemit %#=An Email must be in the format: *@*.* ([email protected]).;th setq(!,%q<value>,valueformat)
&VALID.COLOR #inc=@break/inline strmatch(ansi(setr(!,%0,value),Test),#-*)=@pemit %#='%0' is not a valid color.;th setq(!,ansi(%q<value>,%q<value>),valueformat)
&VALID.WORD #inc=@attach #inc/VALID.BASE=%0;th setq(!,%q<value>,valueformat)
&VALID.LIST #inc=@attach #inc/VALID.BASE=%0;th setq(!,%q<value>,valueformat)
&VALID.BOOL #inc=@attach #inc/VALID.BASE=%0;@assert/inline match(0 1,%q<value>)=@pemit %#={ERROR: BOOL options can only be 0 (false) or 1 (true).};th setq(!,if(%q<value>,True,False),valueformat)
&VALID.DBREF #inc=@assert/inline isdbref(%0)=@pemit %#={ERROR: DBREF not found.};th setq(!,objid(%0),value);th setq(!,name(%q<value>),valueformat)
&VALID.TIMEZONE #inc=@attach #inc/VALID.BASE=%0;@assert/inline valid(timezone,%q<value>)=@pemit %#={That is not a valid timezone. Check +help timezones};th setq(!,%q<value>,valueformat)
&VALID.DURATION #inc=@attach #inc/VALID.BASE=%0;@assert/inline setr(!,stringsecs(%0),value)=@pemit %#={'%0' did not resolve into a time. Example input: 30d 5h 3m for 30 days 5 hours and 3 minutes.};th setq(!,u(etime,%q<value>),valueformat)
&VALID.POSINT #inc=@assert/inline cand(isint(%0),gte(%0,1))=@pemit %#={'[strfirstof(%1,%0)]' must be a whole number 1 or greater.};th setq(!,%0,value);th setq(!,%q<value>,valueformat)
&VALID.POSNUM #inc=@assert/inline gt(setr(!,%0,value),0)=@pemit %#='%0' must be a positive number.;th setq(!,%q<value>,valueformat)
&VALID.NUMBER #inc=@assert/inline isnum(setr(!,%0,value))=@pemit %#='%0' must be a number.;th setq(!,%q<value>,valueformat)
&VALID.INT #inc=@assert/inline isint(%0)=@pemit %#={'%0' must be a whole number 0 or greater.};th setq(!,setr(!,%0,value),valueformat)
&VALID.LOCKKEY #inc=@assert/inline valid(lockkey,%0)=@pemit %#={'%0' was not accepted by the @lock system.};th setq(!,setr(!,%0,value),valueformat)
&VALID.TIME #inc=@assert/inline strlen(%0)=@pemit %#=You didn't enter a date!;@assert/inline gt(setr(!,setr(!,runintz(gettz(%#),convtime(%0)),value),time),0)=@pemit %#=The entered date was not recognized. Did you typo? Dates should be in abbreviated 24-hour <month> <day> <hour>:<minute> format using YOUR timezone\, such as Jun 26 7:00 or Oct 31 13:00. Check [ansi(hw,@list options convtime)] for more information.;th setq(!,runintz(UTC,convsecs(%q<value>)),valueformat)
&VALID.FUTURE #inc=@attach #inc/VALID.TIME;@assert/inline gt(%q<time>,secs())=@pemit %#=That would be in the past!
®ISTER_FUNCTIONS #inc=@dolist/inline lattr(%!/GPFN.*)={@function/protect/privilege [after(%d0,.)]=%!/%d0};@dolist/inline lattr(%!/GFN.*)={@function/protect [after(%d0,.)]=%!/%d0};@dolist/inline lattr(%!/GMFN.*)={@function/protect/privilege gm_[after(%d0,.)]=%!/%d0;@admin function_access=gm_[after(%d0,.)] guildmaster}
&PARTIAL #inc=@if or(not(strlen(%0)),setr(!,match(%1,setr(!,%0,strfirstof(%3,choice)),strfirstof(%2,%b)),matched))={@if cand(t(strlen(%0)),t(%q<matched>))={th setq(!,elementsmux(%1,%q<matched>,strfirstof(%2,%b)),strfirstof(%3,choice))}},{@assert/inline words(setr(!,graball(%1,%0*,strfirstof(%2,%b),strfirstof(%2,%b)),strfirstof(%3,choice)))=@pemit %#={Invalid %4! Valid choices are: [elist(%1,,strfirstof(%2,%b))]};@break/inline gt(words(r(strfirstof(%3,choice)),strfirstof(%2,%b)),1)=@pemit %#={ERROR: %0 matched [elist(r(strfirstof(%3,choice)),,strfirstof(%2,%b))]. Please be more specific.}}
@@ PARTIAL %0 = entry, %1 = choices, %2 = delimiter, %3 = register name, %4 = topic name
&GET_SWITCH #inc=@if strlen(%0)={@attach #inc/PARTIAL=%0,get_switches(%!,%#,%1),|,switch,switch}
&DISPLAY_HELP #inc=th setq(!,iter(setr(!,get(%!/HELP_FILES),hdata),before(%i0,~),|,|),hfiles);@if strlen(%0)={@attach #inc/PARTIAL=%0,%q<hfiles>,|,file,helpfile;@pemit %#=header(Help for: %1 - %q<file>);@pemit %#=u(%!/[get_kv(%q<hdata>,%q<file>)]);@pemit %#=footer()},{@pemit %#=header(Help for %1);@if hasattr(%!/HELP_INDEX)={@pemit %#=u(%!/HELP_INDEX);@pemit %#=separator()};@pemit %#=columns(%q<hfiles>,26,3,l,1,1,,%b,,1,|,,);@pemit %#=footer()}
@@ %0 - file to display? %1 - Help System Name
&CONFIG #inc=@if strlen(%0)={@attach #inc/CONF_SET},{@attach #inc/CONF_LIST}
&CONF_LIST #inc=@pemit %#=header(cname(%2) Options);@dolist/inline/delimit | [u(#conf/FN.LIST_CONFIGS,%2)]={@pemit %#=separator(%d0);@pemit %#=get(%2/CONFIG.%d0.DESC);@pemit %#=[ansi(hw,TYPE:)] [get(%2/CONFIG.%d0.TYPE)];@pemit %#=[ansi(hw,DEFAULT:)] [get(%2/CONFIG.%d0.DEFAULT)];@pemit %#=[ansi(hw,CURRENT:)] [getconf(%2,%d0)]};@pemit %#=footer()
&CONF_SET #inc=@attach %2/CONFIG.PERM;@attach #inc/PARTIAL=%0,u(#conf/FN.LIST_CONFIGS,%2),|,op,option;@attach %2/CONFIG.%q<op>.PERM=%0,%1,%2;@attach #inc/VALID.[get(%2/CONFIG.%q<op>.TYPE)]=%1;th setq(!,getconf(%2,%q<op>),oldvalue);@attach %2/CONFIG.%q<op>.VALID=%q<value>,%q<oldvalue>,%2;@set %2=CONFIG.%q<op>.VALUE:%q<value>;@attach %2/CONFIG.%q<op>.TRIGGER=%q<oldvalue>,%q<value>,%2;@pemit %#=[cname(%2)] %q<op> is now: %q<valueformat>;@attach #inc/MSG_ALERT=[cname(%2)] %q<op> is now: %q<valueformat>
&DOSQL #inc=@break/inline strmatch(setr(!,mysql(before(%0,/),%1,%2,%3,%4,%5,%6,%7,%8,%9),errcheck),#-*)[if(strlen(after(%0,/)),setq(!,sql(SELECT last_insert_id\(\)),after(%0,/)))]={@pemit %#=[ansi(hr,SQL ERROR)] - [before(%0,/)]: %q<errcheck>;@attach #inc/MSG_ALERT=SQL ERROR - %!/[before(%0,/)]: %q<errcheck> - QUERY: %q<sqlformat>}