@@ Org System by Mike Griffiths (talvo@talvo.com). @@ Command list based on an org system by Dahan. @@ Latest version available from www.talvo.com @@ Installation instructions: @@ From a Wizard character, /quote (or copy and paste) the code into the game. @@ Safer_Ufun will need to be off (or you'll need to set %va Wizard). @@ No new attributes, flags or @functions are required (though there are @@ some optional @functions at the end). @@ You'll then need to plug the code into your Econ system by editing the @@ %vb/fun.econ* attributes. ex %vb/fun.econ** for the attrs and descriptions @@ of what they do. The defaults are set to work with Talvo's Econ System @@ available from www.talvo.com @@ Attribute structure for DB: @@ ORG - number of orgs @@ ORG` - name of org @@ ORG``alias - alias of org @@ ORG``ranks - ^-separted list of rank names @@ ORG``ranks_paycheck - ^-separated list of rank wages @@ ORG``balance - total balance of org @@ ORG``balance` - account transaction history @@ ORG``contact - contact msg for org @@ ORG``leaders - list of leaders @@ ORG``primaries - list of primary leaders @@ ORG``motd - motd for an org @@ ORG``parent - id of parent org @@ ORG``children - list of ids of child orgs @@ ORG``describe - description of an org @@ ORG``welcome - welcome message @@ ORG``pending - list of pending apps @@ ORG``members - list of all member's objids. Note child attrs used DBREFs, not OBJIDs @@ ORG``members` - title @@ ORG``members``pay - paycheck @@ ORG``members``lastpaid @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ Create objects @set me=VA:[create(Org System Commands)] @set me=VB:[create(Org System Functions)] @set me=VC:[create(Org System DB)] @dol va vb vc=@cpattr me/##=%va,%vb,%vc @set %va=loud !no_command no_warn [switch(config(safer_ufun),No,,Off,,0,,WIZARD)] @power %va=can_nspemit @set %vb=loud no_command wizard no_warn @set %vc=no_command no_warn @set %vc=ORG:[default(%vc/ORG,1)] @describe %vb=Org System written by Mike Griffiths/Talvo ([v(describe`email)]), available from [v(describe`where)]. Version [v(describe`version)]. List of commands (but not the code itself) based on Dahan's org system. &describe`version %vb=1.2c &describe`email %vb=talvo@talvo.com &describe`where %vb=www.talvo.com @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ Utility functions @@ %0 = org id, %1 = player objid &fun.isleader %vb=cor(orflags(%1,Wr),member(ufun(fun.recurse-list,leaders,%0),%1),ufun(fun.isprimary,%0,%1)) @@ %0 = org id, %1 = player objid &fun.isprimary %vb=cor(orflags(%1,Wr),member(ufun(fun.recurse-list,primaries,%0),%1)) &fun.recurse-list %vb=if(hasattrval(%vc,org`%1`parent),ufun(fun.recurse-list,%0,get(%vc/org`%1`parent),get(%vc/org`%1`%0) %2),setunion(%2,get(%vc/org`%1`%0))) @@ %0 = org id, %1 = player objid. Is %1 the primary leader of %0, or a leader of one of its parent orgs? @@ %0 = org id, %1 = player objid &fun.ismember %vb=switch(1,t(member(get(%vc/org`%0`members),%1)),1,t(strlen(get(%vc/org`%0`parent))),ufun(fun.ismember,get(%vc/org`%0`parent),%1),0) &fun.ismember-noparent %vb=t(member(get(%vc/org`%0`members),%1)) @@ Get the top-level parent for org %0 &fun.get-toplevel-parent %vb=switch(get(%vc/org`%0`parent),,%0,ufun(fun.get-toplevel-parent,get(%vc/org`%0`parent))) @@ Return the toplevel id and nesting depth of org %0 &fun.get-toplevel-parent-with-depth %vb=switch(get(%vc/org`%0`parent),,%0 [firstof(%1,0)],ufun(fun.get-toplevel-parent-with-depth,get(%vc/org`%0`parent),inc(firstof(%1,0)))) @@ Is org %0 a parent of org %1? &fun.isparent %vb=t(member(ulocal(fun.isparent-recurse,%1,),%0)) &fun.isparent-recurse %vb=switch(squish(get(%vc/org`%0`parent)),,%0 %1,ufun(fun.isparent-recurse,#$,%0 %1)) @@ %0 = name or number of org to find &fun.findorg %vb=localize(if(isint(%0),if(hasattr(%vc,org`%0),%0,0),switch(squish(iter(lattr(%vc/org`*),switch(0,comp(%0,get(%vc/##),i),rest(##,`),comp(%0,get(%vc/##`alias),i),rest(##,`)))),* *,0,,0,#$))) @@ List toplevel orgs &fun.list-toplevel-orgs %vb=edit(squish(iter(lattr(%vc/org`*),switch(get(%vc/%i0`parent),,%i0))),ORG`,) @@ List all children of org %0 &fun.list-child-orgs %vb=map(#lambda/elements(%%0,2,`),wildgrep(%vc,org`*`parent,%0)) @@ List all orgs %0 is an implicit (ie, directly, not through parenting) member of &fun.list-member-orgs %vb=squish(edit(iter(grep(%vc,org`*`members,before(%0,:):),if(member(get(%vc/%i0),%0),%i0)),ORG`,,`MEMBERS,)) &fun.orgname %vb=get(%vc/org`%0) &fun.orgalias %vb=get(%vc/org`%0`alias) &fun.orgcontact %vb=get(%vc/org`%0`contact) &fun.valid-orgname %vb=cand(eq(strlen(%0),bound(strlen(%0),1,50)),not(strmatch(%0,*|*)),not(strmatch(%0,*^*))) @@ %0 = recipient, %1 = author, %2 = subject, %3 = message &fun.mail %vb=mailsend(%0,%2/%3) @@ %0 = org, %1 = amount, %2 = player, %3 = description of transaction &fun.log-transfer %vb=attrib_set(%vc/org`%0`balance`[secs()],%3^%2^%1)[switch(nattr(%vc/org`%0`balance`*),>100,iter(extract(revwords(sortkey(#lambda/last(%%0\,`),lattr(%vc/org`%0`balance`*),n)),101,50),attrib_set(%vc/%i0)))] @@ Return the amount of %0's paycheck in org %1, or an empty string if none. &fun.paycheck-amount %vb=localize(default(%vc/org`%1`members`[edit(%0,:,_)]`paycheck,if(setr(1,member(ucstr(get(%vc/org`%1`ranks)),ucstr(get(%vc/org`%1`members`[edit(%0,:,_)])),^)),elements(get(%vc/org`%1`ranks_paycheck),%q1,^)))) &tag %vb=\[+ORG\]%b &fun.tag %vb=ufun(tag) &tag %va=ufun(%vb/fun.tag) @set %va/tag=no_command @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ Econ-related functions @@ Is %0 a valid list of commodities? &fun.econ-valid %vb=econ(valid,%0,words) &fun.econ-valid`desc %vb=FUN.ECON-VALID should return 1 if %0 is valid input for a list of commodities/amount of money/etc for the econ system used, and 0 otherwise. @@ Convert a list of commodities, as typed, into the internal rep &fun.econ-convert-words %vb=econ(convert,%0,words) &fun.econ-convert-words`desc %vb=%0 is a (valid) input of commodities/money/whatever the econ system uses (validated with FUN.ECON-VALID). Convert it to whatever internal rep is used to store commodity data. @@ Convert the interal rep into a displayable list of commodities &fun.econ-convert-ints %vb=econ(convert,%0,ints) &fun.econ-convert-ints`desc %vb=%0 is the interal rep of an amount of commodities/money. Convert it to something suitable for displaying to a player (may be as simple as '%0 dollars') @@ Can player %0 afford to pay (internal rep) %1? &fun.econ-afford %vb=econ(afford,get(%0/MONEY),%1) &fun.econ-afford`desc %vb=Can the player %0 (objid) afford to pay %1? %1 is an internal rep (as returned by FUN.ECOn-CONVERT-WORDS) of an amount of money. @@ Can org %0 afford to pay (internal rep) %1? &fun.econ-afford-org %vb=econ(afford,get(%vc/org`%0`balance),%1) &fun.econ-afford-org`desc %vb=Can the org %0 (org id) afford to pay %1? %1 is an internal rep (as returned by FUN.ECOn-CONVERT-WORDS) of an amount of money. @@ Transfer %0 to org %1 from player %2. This involves decreasing the player's money, increasing %vc's, and then @@ editing the balance attr for the org. &fun.econ-transfer-to-org %vb=econ(adjust,%2,%0,0)[econ(adjust,%vc,%0,1)][attrib_set(%vc/org`%1`balance,econ(add,get(%vc/org`%1`balance),%0))] &fun.econ-transfor-to-org`desc %vb=Transfer %0 (internal rep of money) to the org %1 (org id) from player %2 (objid). You must decrease the player's money, increase %vc's money, and edit the balance attr for the org. @@ Transfer %0 from org %1 to player %2. This involves decreasing %vc's money, increasing the player's, and then @@ editing the balance attr for the org. &fun.econ-transfer-to-player %vb=econ(adjust,%2,%0,1)[econ(adjust,%vc,%0,0)][attrib_set(%vc/org`%1`balance,econ(sub,get(%vc/org`%1`balance),%0))] &fun.econ-transfer-to-player`desc %vb=Transfer %0 (internal rep of money) from the org %1 (org id) to player %2 (objid). You must increase the player's money, decrease %vc's money, and edit the balance attr for the org. @@ Add to lists of commodities (internal reps) together. &fun.econ-add %vb=econ(add,%0,%1) &fun.econ-add`desc %vb=Add %0 and %1 (both internal reps of money) together, and return the internal rep. sub of the two. @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/ACCEPT = &cmd.accept %va=$+org/accept *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.accept,%0,%1)] &fun.accept %vb=switch(0,setr(0,ufun(fun.findorg,%1)),No such org.,t(setr(1,objid(pmatch(%0)))),No such player.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,member(get(%vc/org`%q0`pending),%q1),name(%q1) isn't waiting to join [ufun(fun.orgname,%q0)]!,[ulocal(fun.accept-sub,%q1,%q0)]You approve [name(%q1)]'s application to join [ufun(fun.orgname,%q0)].) @@ Player %0 has been accepted into org %1. Set it up, send him the welcome mail, etc. &fun.accept-sub %vb=nspemit(%0,ufun(tag)%n approves your application to join [setr(1,ufun(fun.orgname,%1))].)[attrib_set(%vc/org`%1`pending,setdiff(get(%vc/org`%1`pending),%0))][attrib_set(%vc/org`%1`members,setunion(get(%vc/org`%1`members),%0))][setq(0,edit(objid(%0),:,_))][attrib_set(%vc/org`%1`members`%q0,New Member)][attrib_set(%vc/org`%1`members`%q0`pay)][ufun(fun.mail,%0,%#,ORG Approval - %q1,ufun(%vc/org`%1`welcome))] @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/ACTIVITY &cmd.activity %va=$+org/activity *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.activity,%0)] &fun.activity %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.ismember,%q0,%:),You aren't a member of that org.,Activity for [ufun(fun.orgname,%q0)]:%r[setq(8,get(%vc/org`%q0`leaders),9,get(%vc/org`%q0`primaries))][iter(sortkey(#lambda/convtime(get(%%0/last)),get(%vc/org`%q0`members),n),ljust(ansi(if(member(%q9,##),gh,if(member(%q8,##),rh,n)),name(##)),18,.)[get(##/last)],,%r)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/ADDRANK =/ &cmd.addrank %va=$+org/addrank *=*/*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.addrank,%0,%1,%2)] &fun.addrank %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,ufun(fun.econ-valid,%2),Invalid paycheck.,ufun(fun.valid-orgname,setr(1,squish(%1))),Invalid rank/title.,not(setr(2,member(ucstr(get(%vc/org`%q0`ranks)),ucstr(%q1),^))),Paycheck for %q1 updated from [ufun(fun.econ-convert-ints,elements(get(%vc/org`%q0`ranks_paycheck),%q2,^))] to [ufun(fun.econ-convert-ints,setr(3,ufun(fun.econ-convert-words,%2)))].[attrib_set(%vc/org`%q0`ranks_paycheck,replace(get(%vc/org`%q0`ranks_paycheck),%q2,%q3,^))],New rank %q1 added with paycheck [ufun(fun.econ-convert-ints,setr(3,ufun(fun.econ-convert-words,%2)))].[attrib_set(%vc/org`%q0`ranks,insert(get(%vc/org`%q0`ranks),-1,%q1,^))][attrib_set(%vc/org`%q0`ranks_paycheck,insert(get(%vc/org`%q0`ranks_paycheck),-1,%q3,^))]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/ALIAS = &cmd.alias %va=$+org/alias *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.alias,%0,%1)] &fun.alias %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.isleader,%0,%:),You need to be an orgl eader to do that.,ufun(fun.valid-orgname,setr(1,squish(%1))),Invalid org name.,not(setr(2,ufun(fun.findorg,%1))),There is already an org with that name.,You change the alias for [ufun(fun.orgname,%q0)] to %q1.[attrib_set(%vc/org`%q0`alias,%q1)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/ALIST &cmd.alist %va=$+org/alist: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.alist,squish(%0))] &fun.alist %vb=switch(0,orflags(%#,Wr),You need to be an admin to do that.,repeat(=,55)%r[ljust(Org,35)][center(M,5)][center(L,5)][center(P,5)][center(W,5)]%r[repeat(-,55)]%r[iter(lattr(%vc/org`*),ljust(get(%vc/##),35)[rjust(words(get(%vc/##`members)),5)][rjust(words(get(%vc/##`leaders)),5)][rjust(words(get(%vc/##`primaries)),5)][rjust(words(get(%vc/##`pending)),5)],,%r)]%r[repeat(=,55)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/APPLY &cmd.apply %va=$+org/apply *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.apply,%0)] &fun.apply %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,not(ufun(fun.ismember,%q0,%:)),You're already a member of that org\, or one of it's parents. If you want to transfer within an org\, talk to an admin.,not(member(get(%vc/org`%q0`pending),%:)),You've already applied to join that org.,attrib_set(%vc/org`%q0`pending,setunion(get(%vc/org`%q0`pending),%:))You apply to join [ufun(fun.orgname,%q0)].[nspemit(setunion(get(%vc/org`%q0`leaders),get(%vc/org`%q0`primaries)),ufun(tag)%n applies to join [ufun(fun.orgname,%q0)].)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/APPOINT = &cmd.appoint %va=$+org/appoint *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.appoint,%0,%1)] &fun.appoint %vb=switch(0,orflags(%#,Wr),You need to be an admin to do that.,setr(0,ufun(fun.findorg,%1)),No such org.,t(setr(1,objid(pmatch(%0)))),No such player.,not(ufun(fun.ismember,%q0,%q1)),name(%q1) is already a member of that org\, or one of it's parents.,You appoint [name(%q1)] into [ufun(fun.orgname,%q0)].[ufun(fun.accept-sub,%q1,%q0)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/BALANCE &cmd.balance %va=$+org/balance *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.balance,%0)] &fun.balance %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,ufun(fun.orgname,%q0) has: [ufun(fun.econ-convert-ints,get(%vc/org`%q0`balance))]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/BOOT = &cmd.boot %va=$+org/boot *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.boot,%0,%1)] &fun.boot %vb=switch(0,setr(0,ufun(fun.findorg,%1)),No such org.,t(setr(1,objid(pmatch(%0)))),No such player.,ufun(fun.isprimary,%q0,%:),You need to be a primary org leader to do that.,ufun(fun.ismember-noparent,%q0,%q1),name(%q1) is not a member of [ufun(fun.orgname,%q0)].,You boot [name(%q1)] from [ufun(fun.orgname,%q0)].[nspemit(%q1,ufun(tag)%n has booted you from [ufun(fun.orgname,%q0)]!)][ufun(fun.quit-sub,%q0,%q1)]) @@ %0 = org num, %1 - player objid &fun.quit-sub %vb=attrib_set(%vc/org`%0`leaders,setdiff(get(%vc/org`%0`leaders),%1))[attrib_set(%vc/org`%0`primaries,setdiff(get(%vc/org`%0`primaries),%1))][attrib_set(%vc/org`%0`members,setdiff(get(%vc/org`%0`members),%1))][wipe(%vc/org`%0`members`[edit(%1,:,_)])] @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/CLEANUP &cmd.cleanup %va=$+org/cleanup: @nspemit/silent %#=ufun(%vb/tag)[if(orflags(%#,Wr),ufun(%vb/fun.cleanup)Old data purged.,You need to be an admin to do that.)] &fun.cleanup %vb=null(iter(lattr(%vc/org`*),attrib_set(%vc/##`primaries,filterbool(#lambda/num(%%0),get(%vc/##`primaries)))[attrib_set(%vc/##`leaders,filterbool(#lambda/num(%%0),get(%vc/##`leaders)))][setq(0,get(%vc/##`members))][attrib_set(%vc/##`members,filterbool(#lambda/num(%%0),get(%vc/##`members)))][iter(setdiff(%q0,get(%vc/##`members)),wipe(%vc/##`members`[edit(%i0,:,_)]))])) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/DELRANK &cmd.delrank %va=$+org/delrank *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.delrank,%0,%1)] &fun.delrank %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,setr(1,member(ucstr(get(%vc/org`%q0`ranks)),ucstr(squish(%1)),^)),No such rank.,attrib_set(%vc/org`%q0`ranks,ldelete(get(%vc/org`%q0`ranks),%q1,^))[attrib_set(%vc/org`%q0`ranks_paycheck,ldelete(get(%vc/org`%q0`ranks_paycheck),%q1,^))]Rank deleted.) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/DEPOSIT &cmd.deposit %va=$+org/deposit *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.deposit,%0,%1)] &fun.deposit %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.econ-valid,%1),Invalid amount.,setq(1,ufun(fun.econ-convert-words,%1))[ufun(fun.econ-afford,%:,%q1)],You don't have that much.,You deposit [ufun(fun.econ-convert-ints,%q1)] into the account of [ufun(fun.orgname,%q0)].[null([ufun(fun.econ-transfer-to-org,%q1,%q0,%:)][ufun(fun.log-transfer,%q0,%:,%q1,deposit)])]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/FORM &cmd.form %va=$+org/form *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.form,%0,%1)] &fun.form %vb=switch(0,orflags(%#,Wr),You need to be an admin to do that.,ufun(fun.valid-orgname,setr(0,squish(%0))),Invalid org name.,ufun(fun.valid-orgname,setr(1,squish(%1))),Invalid alias.,not(ufun(fun.findorg,%q0)),An org with that name already exists.,not(ufun(fun.findorg,%q1)),An org with that alias already exists.,You form a new organisation.[setq(2,get(%vc/org))][setq(3,org`%q2)][attrib_set(%vc/org,add(%q2,1))][attrib_set(%vc/%q3,%q0)][attrib_set(%vc/%q3`alias,%q1)][attrib_set(%vc/%q3`ranks,New Member)][attrib_set(%vc/%q3`ranks_paycheck,0)][attrib_set(%vc/%q3`balance,0)][attrib_set(%vc/%q3`contact,Contact %n\(%:\))][attrib_set(%vc/%q3`leaders,%:)][attrib_set(%vc/%q3`primaries,%:)][attrib_set(%vc/%q3`motd,Hello!)][attrib_set(%vc/%q3`describe,This is a new org.)][attrib_set(%vc/%q3`welcome,Welcome to %q0!)][ufun(fun.accept-sub,%:,%q2)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/LEADER &cmd.leader %va=$+org/leader *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.leader,%0,%1)] &fun.leader %vb=switch(0,setr(0,ufun(fun.findorg,%1)),No such org.,ufun(fun.isleader-parent,%q0,%:),You don't have permission to do that.,t(setr(1,objid(pmatch(%0)))),No such player.,ufun(fun.ismember-noparent,%q0,%q1),Only members of an org can be leaders.,attrib_set(%vc/org`%q0`leaders,setunion(get(%vc/org`%q0`leaders),%q1))You appoint [name(%q1)] has a leader of [ufun(fun.orgname,%q0)].) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/LEADERS &cmd.leaders %va=$+org/leaders: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.leaders)] &fun.leaders %vb=if(orflags(%#,Wr),Leaders by org:%r[iter(lattr(%vc/org`*),%b[get(%vc/%i0)]:%r%b%b%bL: [iter(sort(get(%vc/%i0`leaders),namei),name(%i0))]%r%b%b%bP: [iter(sort(get(%vc/%i0`primaries),namei),name(%i0))],,%r)]%r,You need to be an admin to do that.) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/LEDGER &cmd.ledger %va=$+org/ledger *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.ledger,%0,%1)] &fun.ledger %vb=switch(0,orflags(%#,Wr),You need to be an admin to do that.,setr(0,ufun(fun.findorg,%0)),No such org.,t(setr(1,bound(%1,1,nattr(%vc/org`%q0`balance`*)))),if(nattr(%vc/org`%q0`balance`*),Invalid number.,The ledger is empty.),Last %q1 Transactions for [ufun(fun.orgname,%q0)]:%r[iter(sortkey(last(%%0\,`),lattr(%vc/org`%q0`balance`*),n),null(strmatch(get(%vc/%i0),*^*^*,0 1 2))At [timefmt($x $H:$M:$S,last(##,`))] - [name(%q2)] [switch(%q0,deposit,deposited,withdraw,withdrew,%q0)] [ufun(fun.econ-convert-ints,%q1)],,%r)]%r) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/LIST &cmd.list %va=$^\+org/list((?\:/[^ ]+)+)?(?\: (.+))?$: @nspemit/silent %#=switch(0,eq(words(setr(0,squish(%1,/)),/),words(setr(0,squish(iter(%q0,grab(/member/all/top,%i0*,/),/,/),/)),/)),ufun(%vb/tag)Invalid switch.,not(member(%q0,member,/)),ufun(%vb/fun.list`member,%:,switch(%2,,%:,%2),member(%q0,all,/)),strlen(%2),ufun(%vb/fun.list,iter(ufun(%vb/fun.list-toplevel-orgs),%i0 [if(member(%q0,all,/),999,0)]),member(%q0,all,/),%:,0),lmath(and,setr(1,iter(%2,ufun(%vb/fun.findorg,squish(%i0)),\,,%b))),No such org '[squish(elements(%2,member(%q1,0),\,))]'., if(member(%q0,all,/),ufun(%vb/fun.list,iter(setunion(iter(%q1,ufun(%vb/fun.get-toplevel-parent,%i0)),),%i0 999),1,%:,1),ufun(%vb/fun.list,ulocal(%vb/fun.list`calc-steps,%q1),0,%:,1)) @set %va/cmd.list=regexp &fun.list`header %vb=center(%b+ORG List%b,78,=)%r[ljust(Name,30)][ljust(Alias,10)][ljust(Contact,36)]%r[repeat(-,78)]%r @@ %0 = org id, %1 = nested level in display, %2 = player displaying for (objid), %3 = display child hint? &fun.list`row %vb=ljust(left(switch(%1,0,,,,repeat(-,mul(%1,2))>%b)[ansi(if(ufun(fun.ismember-noparent,%0,%2),h,n),ufun(fun.orgname,%0))],29),30)[ljust(left(ufun(%vb/fun.orgalias,%0),9),10)][ljust(left(ufun(%vb/fun.orgcontact,%0),35),36)][if(cand(%3,setr(0,words(ufun(fun.list-child-orgs,%0)))),%r--> [capstr(spellnum(%q0))] child[switch(%q0,1,,ren)])] &fun.list`footer %vb=%r[repeat(=,78)] @@ %0 = user, %1 = victim, %2 = children? &fun.list`member %vb=switch(0,t(setr(0,locate(%0,%1,PFampy))),ufun(%vb/tag)No such player.,cor(not(comp(%0,%q0,d)),orflags(%0,Wr),haspower(%0,see_all)),ufun(%vb/tag)Permission denied.,strlen(setr(1,ufun(fun.list-member-orgs,objid(%q0)))),switch(comp(%0,%q0,d),0,You are,name(%q0) is) not a member of any orgs.,if(%2,ufun(%vb/fun.list,iter(setunion(iter(%q1,ufun(fun.get-toplevel-parent,%i0)),),%i0 999),%2,objid(%q0),0),ufun(%vb/fun.list,ulocal(fun.list`calc-steps,%q1),%2,objid(%q0),0))) @@ %0 = list of orgs &fun.list`calc-steps %vb=null(setq(0,)[setq(1,)][iter(%0,switch(member(%q0,first(setr(2,ufun(fun.get-toplevel-parent-with-depth,%i0)))),0,setq(0,squish(%q0 [first(%q2)]))[setq(1,squish(%q1 [last(%q2)]))],if(lt(elements(%q1,#$),last(%q2)),setq(1,replace(%q1,#$,last(%q2))))))])[mix(#lambda/%%0 %%1,%q0,%q1)] ufun(%vb/fun.list,setunion(iter(%q1,ufun(fun.get-toplevel-parent,%i0)),),%2,objid(%q0),0)) @@ %0 = top level orgs to show, %1 = show children?, %2 = objid displaying for, %3 = separate toplevel orgs with ---? &fun.list %vb=ufun(fun.list`header)[setq(9,%2)][step(me/fun.list`org,%0,2,,%r[if(%3,repeat(-,78)%r)])][ufun(fun.list`footer)] @@ ufun(fun.list`org,%i0,%1,%2),, &fun.list`org %vb=ufun(fun.list`row,%0,firstof(%9,0),%q9,not(%1))[switch(1,not(strlen(setr(0,ufun(fun.list-child-orgs,%0)))),,gt(%1,firstof(%9,0)),%r[iter(%q0,ufun(fun.list`org,%i0,%1,%2,%3,%4,%5,%6,%7,%8,inc(firstof(%9,0))),,%r)])] @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/MEMBER &cmd.member %va=$+org/member: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.member,%:)] &cmd.member-arg %va=$+org/member *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.member-arg,%0)] &fun.member-arg %vb=switch(0,orflags(%#,Wr),You need to be an admin to do that.,t(setr(0,objid(pmatch(%0)))),No such player.,ufun(fun.member,%q0)) &fun.member %vb=name(%0) is a member of the following orgs: [itemize(squish(iter(lattr(%vc/org`*),if(member(get(%vc/%i0`members),%0),get(%vc/%i0)),,|),|),|)] @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/MOTD &cmd.motd %va=$+org/motd *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.motd,%0)] &fun.motd %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.ismember,%q0,%:),You need to be a member to do that.,MotD for [ufun(fun.orgname,%0)]: [get(%vc/org`%q0`motd)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/NUKE &cmd.nuke %va=$+org/nuke *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.nuke,%0)] &fun.nuke %vb=switch(0,orflags(%#,Wr),You need to be an admin to do that.,setr(0,ufun(fun.findorg,%0)),No such org.,Org removed.[wipe(%vc/org`%q0)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/PARENT &cmd.parent %va=$+org/parent *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.parent,%0,%1)] &fun.parent %vb=switch(0,orflags(%#,Wr),You need to be an admin to do that.,setr(0,ufun(fun.findorg,%0)),No such org '%0'.,setr(1,ufun(fun.findorg,%1)),No such org '%1'.,comp(%q0,%q1),You can't parent an org to itself.,not(ufun(fun.isparent,%q0,%q1)),ufun(fun.orgname,%q0) is a parent of [ufun(fun.orgname,%q1)]\, so cannot be parented to it.,You parent [ufun(fun.orgname,%q0)] to [ufun(fun.orgname,%q1)].[setq(2,get(%vc/org`%q0`parent))][if(hasattrval(%vc,org`%q2`children),attrib_set(%vc/org`%q2`children,setdiff(get(%vc/org`%q2`children),%q0)))][attrib_set(%vc/org`%q0`parent,%q1)][attrib_set(%vc/org`%q1`children,setunion(get(%vc/org`%q1`children),%q0))]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/PAYCHECK &cmd.paycheck %va=$+org/paycheck *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.paycheck,%0)] &fun.paycheck %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.ismember-noparent,%q0,%:),You aren't a member of that org.,strlen(setr(1,ufun(fun.paycheck-amount,%:,%q0))),You don't have a paylevel set. Talk to an org leader.,ufun(fun.econ-afford-org,%q0,%q1),Your org doesn't have enough money to pay you right now.,gte(sub(secs(),default(%vc/org`%q0`members`[edit(%:,:,_)]`lastpaid,0)),u(fun.pay-interval)),It's not payday yet.,null(ufun(fun.econ-transfer-to-player,%q1,%q0,%:))You collect your paycheck of [ufun(fun.econ-convert-ints,%q1)].[attrib_set(%vc/org`%q0`members`[edit(%:,:,_)]`lastpaid,secs())]) &fun.pay-interval %vb=604800 @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/PAYROLL &cmd.payroll %va=$+org/payroll *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.payroll,%0)] &cmd.payroll-all %va=$+org/payroll/all *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.payroll-all,%0)] &fun.payroll %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.ismember-noparent,%q0,%:),You need to be a member to do that.,ufun(fun.payroll-sub,%q0,%:)) &fun.payroll-sub %vb=switch(u(fun.paycheck-amount,%1,%0),,You have no paycheck set. Talk to an org leader to arrange your wages.,Your paycheck is [ufun(%vb/fun.econ-convert-ints,#$)]. [if(hasattrval(%vc,org`%0`members`[edit(%1,:,_)]`lastpaid),You were last paid [squish(timestring(setr(0,sub(secs(),get(%vc/org`%0`members`[edit(%1,:,_)]`lastpaid)))))] ago.,setq(0,secs())You have never been paid.)][if(gte(%q0,u(fun.pay-interval)),%bType +ORG/PAYCHECK %0 to get your paycheck.)]) &fun.payroll-all %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,ufun(fun.payroll-all-sub,%q0)) &fun.payroll-all-sub %vb=Payroll for [ufun(fun.orgname,%0)]%r[setq(0,0,1,0)][iter(sort(get(%vc/org`%0`members),namei),ljust(name(##),23,.) [switch(ufun(fun.paycheck-amount,##,%0),,ansi(rh,NONE SET)[setq(0,add(%q0,1))],setq(1,ufun(fun.econ-add,%q1,#$))[ufun(fun.econ-convert-ints,#$)])],,%r)]%r[switchall(%q0,0,,1,1 Person,>1,%q0 People,>0,%bwithout paychecks.%b)]Total paychecks: [ufun(fun.econ-convert-ints,%q1)]%r @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/PRIMARY &cmd.primary %va=$+org/primary *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.primary,%0,%1)] &fun.primary %vb=switch(0,setr(0,ufun(fun.isorg,%1)),cor(orflags(%#,Wr),ufun(fun.is-primary,%q0,%:)),You need to be a primary org leader or an admin to do that.,t(setr(1,objid(pmatch(%0)))),No such player.,ufun(fun.ismember-noparent,%q0,%q1),name(%q1) is not a member of that org.,You appoint [name(%q1)] as a primary leader of [ufun(fun.orgname,%q0)].[attrib_set(%vc/org`%q0`leaders,setdiff(get(%vc/org`%q0`leaders),%q1))][attrib_set(%vc/org`%q0`primaries,setunion(get(%vc/org`%q0`primaries),%q1))][nspemit(%q1,u(tag)%n appoints you as a primary leader of [ufun(fun.orgname,%q0)].)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/QUIT &cmd.quit %va=$+org/quit *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.quit,%0)] &fun.quit %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.ismember-noparent,%q0,%:),You aren't even a member of that org!,You resign from [ufun(fun.orgname,%q0)].[ufun(fun.quit-sub,%q0,%:)]) @@ %0 = org num, %1 - player objid &fun.quit-sub %vb=attrib_set(%vc/org`%0`leaders,setdiff(get(%vc/org`%0`leaders),%1))[attrib_set(%vc/org`%0`primaries,setdiff(get(%vc/org`%0`primaries),%1))][attrib_set(%vc/org`%0`members,setdiff(get(%vc/org`%0`members),%1))][wipe(%vc/org`%0`members`[edit(%1,:,_)])] @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/RANK &cmd.rank %va=$+org/rank *=*/*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.rank,%0,%1,%2)] &fun.rank %vb=switch(0,setr(0,ufun(fun.findorg,%1)),No such org.,t(setr(1,objid(pmatch(%0)))),No such player.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,ufun(fun.ismember-noparent,%q0,%q1),name(%q1) is not in that org.,You change [name(%q1)]'s rank to %2.[attrib_set(%vc/org`%q0`members`[edit(%q1,:,_)],%2)] [switch(0,hasattrval(%vc/org`%q0`members`[edit(%q1,:,_)]`paycheck)[t(member(ucstr(get(%vc/org`%q0`ranks)),ucstr(%2),^))],00,Note: That rank is not in the ranks list for that org\, and [name(%q1)] has no personal paycheck set. Either set one with +ORG/SETPAY\, or add the rank with +ORG/ADDRANK.,10,\(That rank is not in the ranks table\, but [name(%q1)] has a personal paycheck set.\),11,\(That rank is in the ranks table\, but is overriden by [name(%q1)]'s personal paycheck.\),01,\([name(%q1)] has no personal paycheck set\, but that rank is in the ranks table\, so [name(%q1)]'s paycheck will be taken from there.))]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/RANKS &cmd.ranks %va=$+org/ranks *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.ranks,%0)] &fun.ranks %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.ismember,%q0,%:),You need to be a member to do that.,Ranks in [ufun(fun.orgname,%q0)]:%r[setq(1,get(%vc/org`%q0`ranks_paycheck))][iter(get(%vc/org`%q0`ranks),ljust(%i0,25) [ufun(fun.econ-convert-ints,elements(%q1,#@,^))],^,%r)]%r) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/REJECT &cmd.reject %va=$+org/reject *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.reject,%0,%1)] &fun.reject %vb=switch(0,setr(0,ufun(%vb/fun.findorg,%1)),No such org.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,t(setr(1,objid(pmatch(%0)))),No such player.,member(get(%vc/org`%q0`pending),%q1),name(%q1) has not applied to join [ufun(fun.orgname,%q0)].,You reject [name(%q1)]'s request to join [ufun(fun.orgname,%q0)].[nspemit(%q1,u(tag)%n has rejected your request to join [ufun(fun.orgname,%q0)])][attrib_set(%vc/org`%q0`pending,setdiff(get(%vc/org`%q0`pending),%q1))]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/RENAME &cmd.rename %va=$+org/rename *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.rename,%0,%1)] &fun.rename %vb=switch(0,orflags(%#,Wr),You need to be an admin to do that.,setr(0,ufun(%vb/fun.findorg,%0)),No such org.,ufun(%vb/fun.valid-orgname,%1),Invalid org name.,cor(not(setr(1,ufun(fun.findorg,%1))),eq(%q1,%q0)),There's already an org with that name.,You rename org [setr(2,ufun(fun.orgname,%0))] to %1.[attrib_set(%vc/org`%q0,%1)][nspemit(setunion(get(%vc/org`%q0`members),get(%vc/org`%q0`leaders) [get(%vc/org`%q0`primaries)]),u(tag) Org %q2 has been renamed to %1.)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/RETIRE &cmd.retire %va=$+org/retire *=*/*: @nspemit/silent %#=ufun(%vb/fun.retire,%0,%1,%2) &fun.retire %vb=switch(0,setr(0,ufun(fun.findorg,%1)),No such org.,ufun(fun.is-primary,%q0,%:),You need to be a primary org leader to do that.,t(setr(1,objid(pmatch(%0)))),No such player.,strlen(setr(2,grab(|leader|primary,%2*,|))),Invalid position (should be one of 'leader' or 'primary').,ufun(fun.is-%q2,%q0,%q1),name(%q1) is not [switch(%q2,primary,a primary,an)] org leader of [ufun(fun.orgname,%q0)].,You remove [name(%q1)] as [setr(2,switch(%q2,primary,a primary,an))] org leader for [ufun(fun.orgname,%q0)].[nspemit(%q1,u(tag)%n removes you as %q2 org leader for [ufun(fun.orgname,%q0)])][attrib_set(%vc/org`%q0`[switch(%q2,leader,leaders,primaries)],setdiff(get(%vc/org`%q0`[switch(%q2,leader,leaders,primaries)]),%q1))]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/ROSTER &cmd.roster %va=$+org/roster *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.roster,%0)] &fun.roster %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.is-member,%q0,%:),You need to be a member to do that.,Roster for [ufun(fun.orgname,%q0)]:%r[setq(1,get(%vc/org`%q0`primaries),2,get(%vc/org`%q0`leaders))][table(iter(sort(get(%vc/org`%q0`members),namei),ansi(if(member(%q1,##),yh,if(member(%q2,##),rh,n)),name(##)),,|),25,78,|)]%r) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/SETDESC @@ +ORG/CONTACT @@ +ORG/SETMOTD @@ +ORG/SETWELCOME &cmd.setdesc %va=$+org/setdesc *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.setmsg,%0,%1,Desc)] &cmd.setmotd %va=$+org/setmotd *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.setmsg,%0,%1,MotD)] &cmd.contact %va=$+org/contact *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.setmsg,%0,%1,Contact)] &cmd.setwelcome %va=$+org/setwelcome *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.setmsg,%0,%1,Welcome)] &fun.setmsg %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,attrib_set(%vc/org`%q0`%2,%1)%2 message changed.) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/SETPAY &cmd.setpay %va=$+org/setpay *=*/*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.setpay,%0,%1,%2)] &fun.setpay %vb=switch(0,setr(0,ufun(fun.findorg,%1)),No such org.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,t(setr(1,objid(pmatch(%0)))),No such player.,strlen(%2),attrib_set(%vc/org`%q0`members`[edit(%q1,:,_)]`paycheck)You remove [name(%q1)]'s custom paycheck in [ufun(fun.orgname,%q0)]. [switch(ufun(fun.paycheck-amount,%q0,%q1),,Note: [name(%q1)] now has no paycheck amount. Either set a custom one for [obj(%q1)]\, or add [poss(%q1)] rank into the ranks table.,capstr(poss(%q1)) pay is now taken directly from the ranks table.)],ufun(fun.econ-valid,%2),How much do you want to pay [obj(%q1)]?,attrib_set(%vc/org`%q0`members`[edit(%q1,:,_)]`paycheck,setr(2,ufun(fun.econ-convert-words,%2)))You set a custom paycheck for [name(%q1)] of [ufun(fun.econ-convert-ints,%q2)].) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/UNPARENT &cmd.unparent %va=$+org/unparent *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.unparent,%0)] &fun.unparent %vb=switch(0,orflags(%#,Wr),You need to be an admin to do that.,setr(0,ufun(fun.findorg,%0)),No such org.,hasattrval(%vc,org`%q0`parent),That org has no parent.,setq(1,get(%vc/org`%q0`parent))[attrib_set(%vc/org`%q0`parent)][attrib_set(%vc/org`%q1`children,setdiff(get(%vc/org`%q1`children),%q0))]Parent removed. [if(hasattrval(%vc,org`%q0`children),Note: This org has children\, and their ancestry has now changed. Please check this is correct!)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/WAITING &cmd.waiting %va=$+org/waiting *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.waiting,%0)] &fun.waiting %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,hasattrval(%vc,org`%q0`pending),There are no pending applications for that org.,The following applications are pending for [ufun(fun.orgname,%q0)]:%r%b[itemize(iter(sort(get(%vc/org`%q0`pending),namei),name(##),,|),|)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/WHO &cmd.who %va=$+org/who *: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.who,%0)] &fun.who %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.ismember,%q0,%:),You need to be a member to do that.,Online members of [ufun(fun.orgname,%q0)]:%r[setq(1,get(%vc/org`%q0`primaries),2,get(%vc/org`%q0`leaders))][table(iter(sort(setinter(get(%vc/org`%q0`members),lwhoid(%#),%b,d),idle),ansi(if(member(%q1,##),yh,if(member(%q2,##),rh,n)),name(##)) \([squish(first(timestring(idle(##))))]\),,|),25,78,|)]%r) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ +ORG/WITHDRAW &cmd.withdraw %va=$+org/withdraw *=*: @nspemit/silent %#=ufun(%vb/tag)[ufun(%vb/fun.withdraw,%0,%1)] &fun.withdraw %vb=switch(0,setr(0,ufun(fun.findorg,%0)),No such org.,ufun(fun.isleader,%q0,%:),You need to be an org leader to do that.,ufun(fun.econ-valid,%1),How much do you want to withdraw?,ufun(fun.econ-afford-org,%q0,setr(1,ufun(fun.econ-convert-words,%1))),There isn't enough for that in the org's vault.,You withdraw [ufun(fun.econ-convert-ints,%q1)] from the vault of [ufun(fun.orgname,%q0)].[ufun(fun.econ-transfer-to-player,%q1,%q0,%:)][ufun(fun.log-transfer,%q0,%:,%q1,withdraw)]) @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ OPTIONAL @FUNCTIONS @@ If you want to use these, just set them all, along with the @startup. @@ @@ @startup %vb=@dolist [lattr(me/@func`*)]=@function [last(##,`)]=%!, ##, [get(%!/##`min)], [get(%!/##`max)], [get(%!/##`restrict)] @@ &@func %vb=@functions are stored below this. Tree layout:%r@FUNC` - contains code%r@FUNC``MIN - minimum number of args (optional)%r@FUNC``MAX - maximum number of args (optional)%r@FUNC``RESTRICT - restrictions for @function (optional) @@ @@ orgs([,]) @@ &@func`orgs %vb=switch(0,t(setr(0,locate(%@,%0,PFampy))),#-1 NO SUCH PLAYER,cor(controls(%@,%q0),visible(%@,%q0),orlflags(%@,WIZARD ROYALTY),haspower(%@,SEE_ALL)),#-1 PERMISSION DENIED,t(%1),iter(ufun(fun.list-member-orgs,objid(%q0)),ufun(fun.orgname,%i0),%b,|),ufun(fun.list-member-orgs,objid(%q0))) @@ &@func`orgs`min %vb=1 @@ &@func`orgs`max %vb=2 @@ &@func`orgs`restrict %vb=localize @@ @@ orgmatch() @@ &@func`orgmatch %vb=ufun(fun.findorg,%0) @@ &@func`orgmatch`min %vb=1 @@ &@func`orgmatch`max %vb=1 @@ @@ orginfo(,[name|alias|contact]) @@ &@func`orginfo %vb=switch(0,strlen(setr(0,grab(|name|alias|contact,%1*,|))),#-1 INVALID ARGUMENT,setr(1,ufun(fun.findorg,%0)),#-1 INVALID ORG,switch(%q0,name,ufun(fun.orgname,%q1),alias,ufun(fun.orgalias,%q1),contact,ufun(fun.orgcontact,%q1),#-1)) @@ &@func`orginfo`min %vb=1 @@ &@func`orginfo`max %vb=2 @@ &@func`orginfo`restrict %vb=localize @@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ The list below is the syntax for Dahan's commands, with a few minor modications. They are --NOT-- completely up-to-date @@ for the code above. Check the proper help-files instead. This list is left here only for Talvo's reference, as he plans @@ to implement a couple of other commands later which are listed here, but which aren't hugely important and which he @@ couldn't be bothered doing with the first draft of the code. @@ +org/accept = - accept 's app to join . Leaders only. @@ +org/activity - lists all org members + last connect @@ +org/addrank =/ - Adds a new rank, or changes paycheck for a rank. Org Leader only @@ +org/alias = - changes alias of an org. Admin only. @@ +org/alist - Shows how many leaders, members and active apps there are for each org. Admin only @@ +org/apply - apply to join an org. @@ +org/appoint = - Join a player to an org without them having to apply. Admin only @@ +org/balance - check the balance of an org. Org leaders only. @@ +org/boot = - remove player from org. Org leaders only. @@ +org/cleanup - Cleans up purged players from the org list @@ +org/contact = - Set the contact message shown for the org on +org/list. Leaders only @@ +org/delrank = - remove rank from org table. Leaders only @@ +org/deposit = - Transfer money from you to the given org @@ +org/form = - Creates a new org named with alias @@ +org/leader - Make an org leader. Restricted to primary org leaders, org leaders of parent orgs, and admins @@ +org/leaders - Lists all org leaders. Admin only. @@ +org/ledger = - Shows all financial transactions for the org's account. Org leaders only. @@ +org/list - Lists basic info on all orgs, including alias, type, full name, and contact. @@ +org/member [] - lists all orgs you're in. Admins can check other s. @@ +org/motd - view motd for an org you're in @@ @@@@@+org/move to - move player from one branch of org tree to another, keeping his data. Must be org leader in both, or an admin, to use this @@ +org/nuke - remove an org. Admin only @@ +org/parent = - Parent org1 to org2. Admin only. @@ +org/paycheck - get your weekly paycheck from @@ +org/payroll - Org leaders/admin see how much each member's weekly paycheck is and when it was last collected. Org members get only their own info. @@ +org/primary = - Make primary org leader of . Can only be used by the current primary leader. @@ +org/quit - reseign from an org. @@ +org/rank =/ - set the rank/title for in your active org @@ +org/ranks - List all ranks and their paychecks. Members only @@ +org/reject - reject an app to join your active org. Leaders only @@ +org/rename = - rename an org. admin only @@ +org/retire =/[primary|leader] - remove a player from leadership. Primarys only. @@ +org/roster [] - displays all members, with leaders in red, primary gold. Members only. @@ @@@@@+org/search [name/title/rank/assignment/division]= - search all members and return those whose matches . Members only @@ +org/setdesc = - set an org's description. Leaders only @@ +org/setmotd = - set the motd for an org. Leaders only. @@ +org/setpay =/ - Set the pay of a particular player. Leaders only. @@ +org/setwelcome = - Set message shown to players when they join the org via @mail @@ +org/title = - alias of +org/rank @@ @@@@@+org/tree [<org>] - lists orgs showing parent/child relationships. If given, only the tree <org> is in gets shown @@ +org/unparent <org> - Unparent an org. Admin only @@ +org/waiting [<org>] - list pending apps in an org. Leaders only. @@ @@@@@+org/welcome [<org>] - See the welcome message for an org. Members only. @@ +org/who [<org>] - show online members of an org. Members only. Leaders in red, primary in gold. @@ +org/withdraw <org>=<amount> <currency> - take funds from org. Leaders only.