[FUNCTION ADDGOLD]
IF (<ARGN2>)
SERV.NEWITEM i_gold,<ARGN1>,<ARGN2>
ELSE
NEWGOLD=<ARGN1>
ENDIF

///////////////////////////////

[FUNCTION rtime.year]
return <serv.rtime.format %Y>

[FUNCTION rtime.month]
return <serv.rtime.format %m>

[FUNCTION rtime.day]
return <serv.rtime.format %d>

[FUNCTION rtime.hour]
return <serv.rtime.format %H>

[FUNCTION rtime.minute]
return <serv.rtime.format %M>

[FUNCTION rtime.second]
return <serv.rtime.format %S>

/////////////////

[FUNCTION static]
IF !(<ISEMPTY <ARGS>>)
TARGETFG static_ <args>
ENDIF

[function static_]
serv.newitem <args>
new.p=<targp>
IF (<NEW.TYPE>==t_multi)
NEW.MULTICREATE
ENDIF
new.attr |= attr_move_never
new.timer -1
act=<new>

//////////////

[FUNCTION gate]
SERV.NEWITEM i_moongate_blue
NEW.NAME Moongate
BOUNCE <NEW>
IF (<ISEMPTY <ARGS>>)
NEW.MOREP=<P>
ELSE
NEW.MOREP=<ARGS>
ENDIF
NEW.COLOR=colors_all
NEW.ATTR=attr_static

[PLEVEL 4]
gate

////////////

[plevel 4]
find
findacc
findip

[function find]
if !(<isempty <args>>)
serv.allclients find_test <args>
endif

[function find_test]
IF (STRMATCH(<strsub 0 <HVAL strlen(<args>)> <NAME>>*,<ARGS>))
src.go <p>
ENDIF

[FUNCTION findacc]
if !(<isempty <args>>)
SERV.ALLCLIENTS find_find <ARGS>
endif

[FUNCTION find_find]
IF (STRMATCH(<strsub 0 <HVAL strlen(<args>)> <ACCOUNT>>*,<ARGS>))
SRC.GO <P>
ENDIF

[function findip]
if !(<isempty <args>>)
serv.allclients find_test_ip <args>
endif

[function find_test_ip]
IF (STRMATCH(<strsub 0 <HVAL strlen(<args>)> <ACCOUNT.LASTIP>>*,<ARGS>))
src.go <p>
ENDIF

//////////////

[plevel 4]
gonext

[function gonext]
IF (0<CTAG.NEXTCLI> > <HVAL <SERV.CLIENTS>-1>) || !(<ISEMPTY <ARGS>>)
CTAG.NEXTCLI
ENDIF
GOCLI 0<CTAG.NEXTCLI>
CTAG.NEXTCLI=<HVAL 0<CTAG.NEXTCLI>+1>

[PLEVEL 4]
gonext

////////////

[FUNCTION GETMEMBERLIST]
IF (<member.count>)
LOCAL.MEMBERLIST=<member.0.name>,
FOR <member.count>
IF !(<member.<dlocal._for>>)
RETURN <local.memberlist>
ELSE
LOCAL.MEMBERLIST .= <member.<HVAL <local._for>>.name>,
ENDIF
ENDFOR
ENDIF

[FUNCTION GETALLIGNMENT]
IF !(<more1>)
RETURN Neutral
ELSEIF (<more1>==1)
RETURN Order
ELSEIF (<more1>==2)
RETURN Chaos
ENDIF

[FUNCTION GETMASTER]
IF !(0<MASTERUID>)
REMOVE
RETURN [none]
ELSE
RETURN <MASTER>
ENDIF

////////////////

[function isfood]
IF (<type>==t_fruit) || (<type>==t_grain) || (<type>==t_meat_raw) || (<type>==t_food_raw) || (<type>==t_food)
return 1
else
return 0
ENDIF

[EOF]