#include <properties.h>#include <moving.h>#include "/secure/wizlevels.h"#include "/secure/config.h"#include <userinfo.h>#include <defines.h>#include "MGtool/tool.h"#include "MGtool/toollib.h"#include "MGtool/toollib.c"#include <lpctypes.h>

gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | SETCACHED 4096 |
| #define | XDBG 1 |
| #define | SafeReturn(x) |
| #define | ACTIONS |
Funktionen | |
| static int | security () |
| static int | Write (string str) |
| static int | Command (string str) |
| static varargs object | XFindObj (string str, int silent) |
| static varargs object | FindObj (string str, object env, int silent) |
| static object | VarToObj (string str) |
| static string | VarToFile (string str) |
| static string | VarToPureFile (string str) |
| static void | PrintObj (object obj, string file) |
| static string | ObjFile (object obj) |
| static varargs void | PrintShort (string pre, object obj, string file) |
| static varargs void | DeepPrintShort (object env, int indent, string pre, string file) |
| static string | break_string_hard (string str, int len, string pre) |
| static void | dprop (string key, mixed data, object obj) |
| static string | propflags (string key, object ob) |
| static void | dprop2 (string key, mixed data, object ob) |
| static mixed | propmethods (string key, object ob) |
| static void | dprop3 (string key, mixed data, object ob) |
| static void | DumpProperties (object obj, int flag) |
| static int | MoveObj (object obj1, object obj2, int silent) |
| static void | Destruct (object obj) |
| static void | DeepClean (object obj) |
| static object * | SubNodes (object obj) |
| static void | Inheritance (object obj, string func, string pre) |
| static string | XFile (string file) |
| static string | XFindFile (string file) |
| static void | XMoreFile (string file, int flag) |
| static void | MoreFile (string str) |
| static string | sread_line (int num) |
| static int | CatFile () |
| static int | XGrepFile (string pat, string file, int mode) |
| static void | XExecFile (int line) |
| static void | XmtpScript (string dir, string file, string opt) |
| static string | PlayerIdle (object obj) |
| static string | PlayerAge (object obj) |
| static string | crname (object who) |
| static string | PlayerWho (object obj) |
| static string | PlayerMail (object obj, int flag) |
| static string | PlayerIP (object obj, int flag) |
| static string | PlayerRace (object obj, int flag) |
| static string | PlayerDomain (object obj, int flag) |
| static string | PlayerStats (object obj, int flag) |
| static string | PlayerSnoop (object obj, int flag) |
| static string | PlayerCmdAvg (object obj, int flag) |
| static void | XMsgSay (string str) |
| static void | XMsgTell (string str) |
| static void | XMsgShout (string str) |
| int | move (mixed dest) |
| int | id (string str) |
| string | short () |
| string | _query_short () |
| string | long () |
| string | _query_long () |
| string | name (mixed dummy1, mixed dummy2) |
| int | _query_light () |
| int | _set_light (int x) |
| mixed * | _query_autoloadobj () |
| void | _set_autoloadobj (mixed *args) |
| void | update_tool (mixed *args, object obj) |
| void | create () |
| void | TK (string str) |
| int | Xtk (string str) |
| void | add_insert_hook (object obj) |
| void | init () |
| void | DropObj (object obj) |
| static string | PrepareLine (string str) |
| static string | QuoteLine (string str) |
| static string | UnquoteLine (string str) |
| static string * | ExplodeCmds (string str) |
| varargs int | ParseLine (string str) |
| static int | CallFunc (string verb, string str) |
| static string | GetFunc (string verb, int test) |
| void | actions () |
| void | InsertNotify (object obj) |
| static void | VarCheck (int show) |
| int | write_newinvobj (object obj) |
| int | CommandScan (string arg) |
| int | DoHistory (string line) |
Variablen | |
| inherit std thing | properties |
| static object | cloner |
| static object | msgto = NULL |
| static string * | manpath |
| static string | morefile = NULL |
| static string * | scriptline = NULL |
| static string * | history = allocate(MAX_HISTORY) |
| static int | moreflag = FALSE |
| static int | moreoffset = 1 |
| static int | term = NULL |
| static int | scriptsize = NULL |
| static int | nostore = FALSE |
| static int | xlight = 0 |
| static int | pipe_in = FALSE |
| static int | pipe_out = FALSE |
| static int | pipe_ovr = TRUE |
| static string | pipe_if = NULL |
| static string | pipe_of = NULL |
| static int | xtk = FALSE |
| static mixed * | variable = ({({}),({})}) |
| static string * | cmds |
| static private mapping | line_buffer = ([]) |
| static private string | line_buffer_name = "" |
| static private string | more_searchexpr = "" |
| int | morelines = MORE_LINES |
| int | modi = (MODE_FIRST|MODE_PROTECT|MODE_SHORT) |
| static string | last_file |
| static string * | last_file_buffer |
| static int | last_file_date |
| static int | last_file_size |
| static int | last_file_complete |
| #define SafeReturn | ( | x | ) |
| #define SETCACHED 4096 |
Definiert in Zeile 20 der Datei MGtool.c.
Wird benutzt von propflags().
| mixed* _query_autoloadobj | ( | ) |
Definiert in Zeile 1228 der Datei MGtool.c.
Benutzt AUTOLOAD_ARGS.
01229 { 01230 return AUTOLOAD_ARGS; 01231 }
| int _query_light | ( | ) |
| string _query_long | ( | ) |
Definiert in Zeile 1190 der Datei MGtool.c.
Benutzt cloner, crname(), IS_ARCH, MODE, MODE_SCANCHK, ObjFile(), PREV, RTP, security(), TOOL_NAME, TOOL_VERSION und WDLN.
01191 { 01192 if(cloner&&!security()&&MODE(MODE_SCANCHK)&&!IS_ARCH(RTP)) 01193 { 01194 WDLN(crname(RTP)+" scanned you (long) ["+query_verb()+"] "+ 01195 (PREV ? ObjFile(PREV) : "[destructed object]")); 01196 } 01197 return 01198 "This is "+TOOL_NAME+" version "+TOOL_VERSION+ 01199 " (maintained by Kirk@MorgenGrauen)\n"+ 01200 "Original copyright held by Hyp.\n"+ 01201 "Gamedriver patchlevel: "+__VERSION__+" master object: "+__MASTER_OBJECT__+ 01202 "\n\nDo 'xhelp' for more information.\n"; 01203 }

| string _query_short | ( | ) |
Definiert in Zeile 1170 der Datei MGtool.c.
Benutzt cloner, crname(), ctime(), IS_ARCH, MODE, MODE_SCANCHK, ObjFile(), P_SHORT, PREV, Query(), RTP, security(), SUBSTR, TOOL_TITLE, WDLN und WESSEN.
01171 { 01172 string sh; // added by Rumata 01173 if(cloner) 01174 { 01175 if((!security())&&MODE(MODE_SCANCHK)&&!IS_ARCH(RTP)) 01176 WDLN(crname(RTP)+" scanned you (short) ["+query_verb()+"] "+ 01177 (PREV ? ObjFile(PREV) : "[destructed object]")); 01178 if( sh=Query(P_SHORT) ) return sh; // added by Rumata 01179 return cloner->name(WESSEN)+" "+TOOL_TITLE+" ["+ 01180 SUBSTR(ctime(time()), 11, 18)+"]"; 01181 } 01182 return TOOL_TITLE; 01183 }

| void _set_autoloadobj | ( | mixed * | args | ) |
Definiert in Zeile 1233 der Datei MGtool.c.
Benutzt TOOL_INTERNAL, TOOL_TITLE, W und WLN.
01234 { 01235 WLN(TOOL_TITLE+" ..."); 01236 if(!pointerp(args)) 01237 ; 01238 else if(sizeof(args)!=3) 01239 ; 01240 else if(!stringp(args[0])) 01241 ; 01242 else if(!intp(args[1])) 01243 ; 01244 else if(!intp(args[2])) 01245 ; 01246 else 01247 { 01248 if((string)args[0]!=TOOL_INTERNAL) 01249 { 01250 WLN("*****************************"); 01251 WLN("*** NEW EDITION ***"); 01252 WLN("*** do 'xtool news' for ***"); 01253 WLN("*** more information ***"); 01254 WLN("*****************************"); 01255 } 01256 modi=(int)args[1]; 01257 morelines=(int)args[2]; 01258 return; 01259 } 01260 W("(bad autoload, using default)\n"); 01261 }
| int _set_light | ( | int | x | ) |
| void actions | ( | ) |
Definiert in Zeile 1680 der Datei MGtool.c.
Benutzt cloner, query_wiz_level() und RTP.
Wird benutzt von init().
01681 { 01682 if (!cloner||!RTP||cloner==RTP||query_wiz_level(cloner)<=query_wiz_level(RTP)) 01683 add_action("ParseLine","",1); 01684 add_action("CommandScan", "", 1); 01685 }


| void add_insert_hook | ( | object | obj | ) |
| static string break_string_hard | ( | string | str, | |
| int | len, | |||
| string | pre | |||
| ) | [static] |
Definiert in Zeile 374 der Datei MGtool.c.
Benutzt p.
Wird benutzt von dprop(), dprop2() und dprop3().
00375 { 00376 int s,p,t; 00377 string tmp; 00378 00379 if(!str||!(s=strlen(str))) 00380 return ""; 00381 t=len-(p=strlen(pre))-1; 00382 00383 tmp=""; 00384 while(p+s>len) 00385 { 00386 tmp+=pre+str[0..t]+"\n"; 00387 str=str[t+1..]; 00388 s-=t; 00389 } 00390 if(strlen(str)) 00391 tmp+=pre+str[0..]+"\n"; 00392 return tmp; 00393 }

| static int CallFunc | ( | string | verb, | |
| string | str | |||
| ) | [static] |
Definiert in Zeile 1606 der Datei MGtool.c.
Benutzt FALSE, GetFunc(), ME, NULL und TK().
Wird benutzt von ParseLine().
01607 { 01608 string fun; 01609 01610 fun=GetFunc(verb,FALSE); 01611 #ifdef XDBG 01612 TK("CallFunc: verb: "+verb+" str: "+str); 01613 TK("CallFunc: resolved function: "+(fun?fun:"(unresolved)")); 01614 #endif 01615 if(str=="") 01616 str=NULL; 01617 return fun?(int)call_other(ME,fun,str):FALSE; 01618 }


| static int CatFile | ( | ) | [static] |
Definiert in Zeile 834 der Datei MGtool.c.
Benutzt FALSE, moreoffset, sread_line(), TRUE und W.
Wird benutzt von MoreFile().
00835 { 00836 int end; 00837 string l; 00838 00839 end=moreoffset+morelines; 00840 while(moreoffset<end) 00841 // if((l=read_file(morefile, moreoffset, 1))!="") 00842 if((l=sread_line(moreoffset))!="") 00843 { 00844 moreoffset++; 00845 W(l); 00846 } 00847 else 00848 return FALSE; 00849 // if(read_file(morefile, moreoffset+1, 1)!="") 00850 if(sread_line(moreoffset+1)!="") 00851 return TRUE; 00852 else 00853 return FALSE; 00854 }


| static int Command | ( | string | str | ) | [static] |
Definiert in Zeile 128 der Datei MGtool.c.
Benutzt cloner, i, MODE, MODE_ECHO, nostore, TK() und WLN.
Wird benutzt von DoHistory() und XExecFile().
00129 { 00130 int i; 00131 TK("Command: str: "+(str?str:"(NULL)")); 00132 nostore++; 00133 if(MODE(MODE_ECHO)) 00134 WLN("Doing: "+str); 00135 i=(int)cloner->command_me(str); 00136 nostore--; 00137 return i; 00138 }


| int CommandScan | ( | string | arg | ) |
Definiert in Zeile 1725 der Datei MGtool.c.
Benutzt cloner, crname(), destruct(), DoHistory(), FALSE, ME, MODE, MODE_PROTECT, nostore, query_wiz_level(), RTP, security(), TOOL_TITLE, TRUE und WDLN.
01726 { 01727 string verb, cmd; 01728 object rtp; 01729 rtp=RTP; 01730 01731 if(!cloner&&!(cloner=rtp)) destruct(ME); 01732 01733 if((!MODE(MODE_PROTECT))||security()|| 01734 query_wiz_level(cloner)<query_wiz_level(rtp)) 01735 { 01736 verb=query_verb(); 01737 if(verb&&DoHistory(verb+(arg ? " "+arg : ""))) 01738 return TRUE; 01739 nostore=FALSE; 01740 return FALSE; 01741 } 01742 else 01743 { 01744 if(rtp) 01745 { 01746 WDLN("Your "+TOOL_TITLE+" protects you from a force by "+crname(rtp)+ 01747 " ["+query_verb()+(arg ? " "+arg+"]" : "]")); 01748 tell_object(rtp, crname(cloner)+"'s "+TOOL_TITLE+ 01749 " absorbes your force.\n"); 01750 } 01751 else 01752 { 01753 WDLN("Your "+TOOL_TITLE+" protects you from a force ["+ 01754 query_verb()+(arg ? " "+arg+"]" : "]")); 01755 } 01756 return TRUE; 01757 } 01758 }

| void create | ( | ) |
Definiert in Zeile 1277 der Datei MGtool.c.
Benutzt call_out(), cloner, destruct(), ENV, IS_LEARNER, ME, member_array(), MODE, MODE_FIRST, P_NEVERDROP, P_NOBUY, P_NODROP, restore_object(), SAVE_FILE, SetProp(), TOOL_TITLE, TP und WDLN.
01278 { 01279 object obj; 01280 01281 if(member_array('#', object_name())<0) 01282 return; 01283 if(!cloner&&!((cloner=TP)||(cloner=ENV(ME)))&&!interactive(cloner)) 01284 destruct(ME); 01285 if(!IS_LEARNER(cloner)) 01286 destruct(ME); 01287 SetProp(P_NODROP,"Das waere zu gefaehrlich.\n"); 01288 SetProp(P_NEVERDROP,1); 01289 SetProp(P_NOBUY,1); 01290 if(file_size(SAVE_FILE+".o")>0) 01291 { 01292 WDLN("Loading "+TOOL_TITLE+" settings"); 01293 restore_object(SAVE_FILE); 01294 } 01295 if(MODE(MODE_FIRST)) 01296 call_out("move",0,cloner); 01297 call_out("add_insert_hook",1,ME); 01298 }

| static string crname | ( | object | who | ) | [static] |
Definiert in Zeile 977 der Datei MGtool.c.
Wird benutzt von _query_long(), _query_short(), CommandScan(), id(), init(), PlayerCmdAvg(), PlayerDomain(), PlayerIP(), PlayerMail(), PlayerRace(), PlayerSnoop(), PlayerStats() und PlayerWho().
00978 { 00979 string uid, lname; 00980 00981 if((uid=getuid(who))==ROOTID && 00982 object_name(who)[0..7]=="/secure/" && 00983 (lname=(string)who->loginname())) 00984 return CAP(lname); 00985 return CAP(uid); 00986 }

| static void DeepClean | ( | object | obj | ) | [static] |
Definiert in Zeile 517 der Datei MGtool.c.
Benutzt Destruct(), is_not_player() und ME.
00518 { 00519 if(!obj) 00520 return; 00521 filter(filter(deep_inventory(obj), "is_not_player", ME), 00522 "Destruct", ME); 00523 if(is_not_player(obj)) 00524 Destruct(obj); 00525 }

| static varargs void DeepPrintShort | ( | object | env, | |
| int | indent, | |||
| string | pre, | |||
| string | file | |||
| ) | [static] |
Definiert in Zeile 352 der Datei MGtool.c.
Benutzt ARIGHT, FORALL, i, item, PrintShort(), SECURE1 und W.
00353 { 00354 int i; 00355 object item; 00356 string str; 00357 00358 SECURE1(); 00359 if(!env) 00360 return; 00361 for(i=indent,str=""; i--; str+=" "); 00362 if(pre) 00363 str+=pre; 00364 if(!file||file=="") 00365 W(str); 00366 else 00367 write_file(file,str); 00368 i++; 00369 PrintShort("",env,file); 00370 FORALL(item, env) 00371 DeepPrintShort(item,indent+1,ARIGHT((++i)+". ",4," "),file); 00372 }

| static void Destruct | ( | object | obj | ) | [static] |
Definiert in Zeile 508 der Datei MGtool.c.
Benutzt destruct().
Wird benutzt von DeepClean() und update_tool().
00509 { 00510 if(!obj || !this_object()) 00511 return; 00512 catch(obj->remove()); 00513 if(objectp(obj) && !query_once_interactive(obj)) 00514 destruct(obj); 00515 }


| int DoHistory | ( | string | line | ) |
Definiert in Zeile 1760 der Datei MGtool.c.
Benutzt ALEFT, ARIGHT, Command(), FALSE, history, MAX_HISTORY, nostore, SECURE2, string_replace, strip_explode(), SUBSTR, TRUE, W und WLN.
Wird benutzt von CommandScan().
01761 { 01762 int i; 01763 string cmd, *strs; 01764 01765 SECURE2(FALSE); 01766 if(!line) 01767 return TRUE; 01768 else if(line=="%!") 01769 { 01770 WLN("Current command history:"); 01771 for(i=MAX_HISTORY; i; --i) 01772 if(history[i-1]) 01773 { 01774 W(" "+ARIGHT(""+i, 2, " ")+": "); 01775 if(strlen(history[i-1])>70) 01776 WLN(ALEFT(history[i-1], 70, " ")); 01777 else 01778 WLN(history[i-1]); 01779 } 01780 return TRUE; 01781 } 01782 else if(SUBSTR(line, 0, 1)=="%%"&&(cmd=history[0]+SUBSTR(line, 2, -1))) 01783 { 01784 Command(cmd); 01785 return TRUE; 01786 } 01787 else if(line[0]=='^'&&(strs=strip_explode(line, "^"))) 01788 { 01789 if(sizeof(strs)&&strs[0]&&(cmd=history[0])) 01790 { 01791 if(sizeof(strs)==2) 01792 cmd=string_replace(cmd, strs[0], strs[1]); 01793 else 01794 cmd=string_replace(cmd, strs[0], ""); 01795 nostore--; 01796 Command(cmd); 01797 nostore++; 01798 return TRUE; 01799 } 01800 } 01801 else if(line[0]=='%'&&(sscanf(SUBSTR(line, 1, -1), "%d", i))) 01802 { 01803 i= i>0 ? i : 1; 01804 i= i<=MAX_HISTORY ? i : MAX_HISTORY; 01805 if(cmd=history[i-1]) 01806 Command(cmd); 01807 return TRUE; 01808 } 01809 else if(line[0]=='%') 01810 { 01811 for(i=0; i<MAX_HISTORY; i++) 01812 { 01813 if(history[i]&& 01814 SUBSTR(history[i], 0, strlen(line)-2)==SUBSTR(line, 1, -1)) 01815 { 01816 Command(history[i]); 01817 return TRUE; 01818 } 01819 } 01820 } 01821 else if(nostore<1) 01822 history=({line})+history[0..MAX_HISTORY-2]; 01823 return FALSE; 01824 }


| static void dprop | ( | string | key, | |
| mixed | data, | |||
| object | obj | |||
| ) | [static] |
Definiert in Zeile 395 der Datei MGtool.c.
Benutzt ALEFT, break_string_hard(), MAX_RECURSION, mixed_to_string(), pipe_of, pipe_out und W.
00396 { 00397 if(pipe_out&&pipe_of) 00398 write_file(pipe_of,break_string_hard(mixed_to_string(obj->QueryProp(key),MAX_RECURSION),78,ALEFT(key+" ",18,".")+" = ")); 00399 else 00400 W(break_string_hard(mixed_to_string(obj->QueryProp(key),MAX_RECURSION),78,ALEFT(key+" ",18,".")+" = ")); 00401 }

| static void dprop2 | ( | string | key, | |
| mixed | data, | |||
| object | ob | |||
| ) | [static] |
Definiert in Zeile 420 der Datei MGtool.c.
Benutzt ALEFT, break_string_hard(), MAX_RECURSION, mixed_to_string(), pipe_of, pipe_out, propflags() und W.
00421 { 00422 if(pipe_out&&pipe_of) 00423 write_file(pipe_of,break_string_hard(mixed_to_string(propflags(key,ob),MAX_RECURSION),78,ALEFT(key+" ",18,".")+" = ")); 00424 else 00425 W(break_string_hard(mixed_to_string(propflags(key,ob),MAX_RECURSION),78,ALEFT(key+" ",18,".")+" = ")); 00426 }

| static void dprop3 | ( | string | key, | |
| mixed | data, | |||
| object | ob | |||
| ) | [static] |
Definiert in Zeile 433 der Datei MGtool.c.
Benutzt ALEFT, break_string_hard(), MAX_RECURSION, mixed_to_string(), pipe_of, pipe_out, propmethods() und W.
00434 { 00435 if(pipe_out&&pipe_of) 00436 write_file(pipe_of,break_string_hard(mixed_to_string(propmethods(key,ob),MAX_RECURSION),78,ALEFT(key+" ",18,".")+" = ")); 00437 else 00438 W(break_string_hard(mixed_to_string(propmethods(key,ob),MAX_RECURSION),78,ALEFT(key+" ",18,".")+" = ")); 00439 }

| void DropObj | ( | object | obj | ) |
| static void DumpProperties | ( | object | obj, | |
| int | flag | |||
| ) | [static] |
Definiert in Zeile 441 der Datei MGtool.c.
Benutzt PIPE_DELETE, pipe_of und SECURE1.
00442 { 00443 SECURE1(); 00444 if(!obj) 00445 return; 00446 PIPE_DELETE(pipe_of); 00447 switch (flag) { 00448 case 0: 00449 walk_mapping(((mapping *)(obj->__query_properties()))[0],#'dprop,obj); //') 00450 break; 00451 case 1: 00452 walk_mapping(((mapping *)(obj->__query_properties()))[0],#'dprop2,obj); //') 00453 break; 00454 case 2: 00455 walk_mapping(((mapping *)(obj->__query_properties()))[0],#'dprop3,obj); //') 00456 break; 00457 } 00458 }
| static string* ExplodeCmds | ( | string | str | ) | [static] |
Definiert in Zeile 1472 der Datei MGtool.c.
Wird benutzt von ParseLine().
01473 { 01474 string *tmp; 01475 01476 tmp=regexplode(str,"\\||>|>>"); 01477 while(tmp[<1]=="") 01478 tmp=tmp[0..<2]; 01479 return tmp; 01480 }

| static varargs object FindObj | ( | string | str, | |
| object | env, | |||
| int | silent | |||
| ) | [static] |
Definiert in Zeile 178 der Datei MGtool.c.
Benutzt ENV, find_living(), find_player(), inv(), long_path(), LOWER, NULL, string_replace, SUBSTR, VarToObj(), W und WDLN.
Wird benutzt von XFindObj().
00179 { 00180 object obj, *inv; 00181 string tmp; 00182 int num, e; 00183 00184 if(!(str&&env)) 00185 return NULL; 00186 str=string_replace(str, "°01", "."); 00187 while(str[e++]=='^') 00188 ; 00189 str=SUBSTR(str, --e, -1); 00190 str=string_replace(str, "°02", "^"); 00191 if(obj=VarToObj(str)) 00192 ; 00193 else if(str[0]=='') 00194 str=string_replace(str, "°03", "$"); 00195 else if(sscanf(str, "%d", num)&&(inv=all_inventory(env))) 00196 { 00197 if(num>0&&num<=sizeof(inv)) 00198 obj=inv[num-1]; 00199 else 00200 { 00201 WDLN("Specified object number out of range [1-"+sizeof(inv)+"]"); 00202 return NULL; 00203 } 00204 } 00205 if(obj||(obj=present(str, env))|| 00206 (obj=find_player(LOWER(str)))|| 00207 (obj=find_living(str))|| 00208 (obj=find_object(long_path(str)))) 00209 { 00210 while(e--) 00211 { 00212 if(!(obj=ENV(obj))) 00213 { 00214 W("Specified object has no environment ["); 00215 while(e--) 00216 W("^"); 00217 WDLN(str+"]"); 00218 return NULL; 00219 } 00220 } 00221 } 00222 else 00223 if(!silent) 00224 WDLN("Specified object does not exist ["+str+"]"); 00225 return obj; 00226 }


| static string GetFunc | ( | string | verb, | |
| int | test | |||
| ) | [static] |
Definiert in Zeile 1620 der Datei MGtool.c.
Benutzt ACTIONS, keys, len, notify_fail(), pipe_if, PIPE_IN, pipe_in, pipe_of, PIPE_OUT, pipe_out, pipe_ovr, TK() und WLN.
Wird benutzt von CallFunc() und ParseLine().
01621 { 01622 string fun,*keys,key; 01623 int i,len; 01624 01625 TK("GetFunc: verb: "+verb); 01626 01627 if(verb[0..0]!="x") // Assume all commands start with "x" 01628 return 0; 01629 01630 if (!(fun=(string)ACTIONS[verb,0])) { // Try exact hit first 01631 key=""; 01632 len=strlen(verb); 01633 for (i=sizeof(keys=m_indices(ACTIONS))-1;i>=0;i--) { 01634 TK(" trying: "+keys[i]); 01635 if(strlen(keys[i])>=len&&keys[i][0..len-1]==verb) { 01636 if(strlen(key)) { 01637 WLN("Das ist nicht eindeutig ..."); 01638 return 0; 01639 } 01640 fun=ACTIONS[keys[i],0]; 01641 key=keys[i]; 01642 //break; 01643 } 01644 } 01645 } else 01646 key=verb; 01647 01648 if(test) 01649 return fun; 01650 01651 if (key) { 01652 #ifdef XDBG 01653 TK("GetFunc: fun: "+fun+" (key: "+key+")\n"+ 01654 "pipe_in: "+(pipe_in?"TRUE ":"FALSE ")+(pipe_if?pipe_if:"(NULL)")+"\n"+ 01655 "pipe_out: "+(pipe_out?"TRUE ":"FALSE ")+(pipe_of?pipe_of:"(NULL)")+"\n"+ 01656 "pipe_ovr: "+(pipe_ovr?"TRUE":"FALSE")); 01657 #endif 01658 if (pipe_in&&!ACTIONS[key,PIPE_IN]) 01659 { 01660 // this command does not read pipes 01661 #ifdef XDBG 01662 TK("Illegal rhs of command pipe \""+fun+"\"\n"); 01663 #endif 01664 notify_fail("Illegal rhs of command pipe \""+fun+"\"\n"); 01665 return 0; 01666 } 01667 else if (pipe_out&&!ACTIONS[key,PIPE_OUT]) 01668 { 01669 // this command does not feed pipes 01670 #ifdef XDBG 01671 TK("Illegal lhs of command pipe \""+fun+"\"\n"); 01672 #endif 01673 notify_fail("Illegal lhs of command pipe \""+fun+"\"\n"); 01674 return 0; 01675 } 01676 } 01677 return fun; 01678 }


| int id | ( | string | str | ) |
Definiert in Zeile 1153 der Datei MGtool.c.
Benutzt crname(), IS_ARCH, LOWER, MODE, MODE_SCANCHK, ObjFile(), PREV, RTP, security(), TOOL_NAME und WDLN.
01154 { 01155 if(!security()&&MODE(MODE_SCANCHK)&&RTP&&!IS_ARCH(RTP)) 01156 WDLN(crname(RTP)+" scanned you (id) ["+query_verb()+"] "+ 01157 (PREV ? ObjFile(PREV) : "[destructed object]")); 01158 return LOWER(str)==LOWER(TOOL_NAME); 01159 }

| static void Inheritance | ( | object | obj, | |
| string | func, | |||
| string | pre | |||
| ) | [static] |
Definiert in Zeile 547 der Datei MGtool.c.
Benutzt ALEFT, ARIGHT, i, ObjFile(), pipe_of, pipe_out, SubNodes() und WLN.
00548 { 00549 int i, s; 00550 object *ln; 00551 string str; 00552 00553 if(!obj) 00554 return; 00555 str=pre+" "+ObjFile(obj); 00556 if(func) 00557 { 00558 str=ALEFT(str+" ", 50, "."); 00559 if(function_exists(func, obj)==object_name(obj)) 00560 str+=ARIGHT(" "+func, 19, "."); 00561 else 00562 str+=ARIGHT("", 19, "."); 00563 } 00564 if(pipe_out&&pipe_of) 00565 write_file(pipe_of,str+"\n"); 00566 else 00567 WLN(str); 00568 ln=SubNodes(obj); 00569 for(i=0; i<sizeof(ln); i++) 00570 ln=ln-SubNodes(ln[i]); 00571 s=sizeof(ln); 00572 for(i=0; i<s; i++) 00573 Inheritance(ln[i], func, pre+"....."); 00574 }

| void init | ( | ) |
Definiert in Zeile 1320 der Datei MGtool.c.
Benutzt actions(), call_out(), cloner, crname(), ENV, IS_ARCH, is_player(), ME, member_array(), MODE, MODE_FIRST, MODE_PROTECT, move() und WDLN.
01321 { 01322 object first, prev; 01323 01324 if(member_array('#', object_name())<0) return; 01325 first=first_inventory(ENV(ME)); 01326 if(MODE(MODE_PROTECT)&&is_player(first)&&!IS_ARCH(first)) 01327 { 01328 WDLN("WARNING: "+crname(first)+" tried to move into your inventory"); 01329 tell_object(first, "You cannot move yourself into "+ 01330 crname(cloner)+"'s inventory.\n"); 01331 call_out("DropObj",0,first); 01332 return; 01333 } 01334 else if(MODE(MODE_FIRST)&&first!=ME) 01335 move(cloner); 01336 else actions(); 01337 }

| void InsertNotify | ( | object | obj | ) |
Definiert in Zeile 1691 der Datei MGtool.c.
Benutzt call_out(), cloner, MODE, MODE_FIRST, MODE_INVCHECK und write_newinvobj().
01692 { 01693 if(!cloner) 01694 return; 01695 if(MODE(MODE_FIRST) && find_call_out("move")==-1) 01696 call_out("move",0,cloner); 01697 if(MODE(MODE_INVCHECK)) 01698 write_newinvobj(obj); 01699 }

| string long | ( | ) |
Definiert in Zeile 1185 der Datei MGtool.c.
Benutzt _query_long().
01186 { 01187 return _query_long(); 01188 }

| static void MoreFile | ( | string | str | ) | [static] |
Definiert in Zeile 705 der Datei MGtool.c.
Benutzt CatFile(), FALSE, i, input_to(), morefile, moreflag, moreoffset, NULL, PIPE_FILE, SECURE1, SUBSTR, term, TMP_FILE, TRUE, W, WDLN und WLN.
Wird benutzt von XMoreFile().
00706 { 00707 int i, off; 00708 string f, l, r; 00709 00710 SECURE1(); 00711 00712 if (str /*&& strlen(str)*/) 00713 { 00714 if( !strlen(str) ) str="\0"; 00715 if(term) 00716 W("M[1M"); 00717 switch(str[0]) 00718 { 00719 case 'q': 00720 case 'x': 00721 moreflag=FALSE; 00722 moreoffset=1; 00723 if(morefile==TMP_FILE||morefile==PIPE_FILE) 00724 rm(morefile); 00725 return NULL; 00726 break; 00727 case 'P': 00728 case 'U': 00729 moreflag=FALSE; 00730 moreoffset=moreoffset-morelines; 00731 case 'p': 00732 case 'u': 00733 moreoffset=moreoffset-2*morelines; 00734 break; 00735 case 'D': 00736 case 'N': 00737 moreoffset+=morelines; 00738 case 0: /* RETURN */ 00739 case 'd': 00740 if(moreflag) 00741 { 00742 moreflag=FALSE; 00743 moreoffset=1; 00744 if(morefile==TMP_FILE) 00745 rm(morefile); 00746 return; 00747 } 00748 break; 00749 case '/': 00750 moreoffset--; 00751 more_searchexpr=SUBSTR(str, 1, -1); 00752 case 'n': 00753 i=moreoffset-morelines+1; 00754 if(more_searchexpr=="") 00755 { 00756 WDLN("No previous regular expression"); 00757 return; 00758 } 00759 if(!regexp(({"dummy"}), more_searchexpr)) 00760 WDLN("Bad regular expression"); 00761 else 00762 while((l=read_file(morefile, i++, 1))&& 00763 !sizeof(regexp(({l}), more_searchexpr))) 00764 ; 00765 if(l) 00766 { 00767 WLN("*** Skipping ..."); 00768 moreoffset=i-1; 00769 } 00770 else 00771 { 00772 WLN("*** Pattern not found"); 00773 moreoffset-=morelines; 00774 } 00775 break; 00776 case '0'..'9': 00777 sscanf(str, "%d", i); 00778 moreoffset=i; 00779 break; 00780 } 00781 } 00782 else 00783 { 00784 moreoffset=1; 00785 moreflag=FALSE; 00786 } 00787 if(moreoffset<1) 00788 moreoffset=1; 00789 if(CatFile()) 00790 W("*** More: q,u,U,d,D,/<regexp>,<line> ["+(moreoffset-1)+"] *** "); 00791 else 00792 { 00793 W("*** More: q,u,U,d,D,/<regexp>,<line> ["+(moreoffset-1)+"=EOF] *** "); 00794 moreflag=TRUE; 00795 } 00796 input_to("MoreFile"); 00797 return; 00798 }


| int move | ( | mixed | dest | ) |
| static int MoveObj | ( | object | obj1, | |
| object | obj2, | |||
| int | silent | |||
| ) | [static] |
Definiert in Zeile 464 der Datei MGtool.c.
Benutzt ENV, err, FALSE, M_NOCHECK, M_SILENT, ME_CANT_TPORT_IN, ME_CANT_TPORT_OUT, ME_PLAYER, ME_TOO_HEAVY, SECURE2, TRUE und WDLN.
00465 { 00466 int err; 00467 object oldenv; 00468 00469 SECURE2(FALSE); 00470 if(!(obj1&&obj2)) 00471 return FALSE; 00472 oldenv=ENV(obj1); 00473 err=(int)obj1->move(obj2, M_SILENT|M_NOCHECK); 00474 if(!silent) 00475 switch(err) 00476 { 00477 case ME_PLAYER: 00478 WDLN("Object returned ME_PLAYER"); 00479 if(oldenv && oldenv != ENV(obj1)) 00480 WDLN("Object has been moved"); 00481 return FALSE; 00482 case ME_TOO_HEAVY: 00483 WDLN("Object returned ME_TOO_HEAVY"); 00484 if(oldenv && oldenv != ENV(obj1)) 00485 WDLN("Object has been moved"); 00486 return FALSE; 00487 case ME_CANT_TPORT_IN: 00488 WDLN("Object returned ME_CANT_TPORT_IN"); 00489 if(oldenv && oldenv != ENV(obj1)) 00490 WDLN("Object has been moved"); 00491 return FALSE; 00492 case ME_CANT_TPORT_OUT: 00493 WDLN("Object returned ME_CANT_TPORT_OUT"); 00494 if(oldenv && oldenv != ENV(obj1)) 00495 WDLN("Object has been moved"); 00496 return FALSE; 00497 default: 00498 WDLN("Object returned unknown return value"); 00499 return FALSE; 00500 } 00501 return TRUE; 00502 }
| string name | ( | mixed | dummy1, | |
| mixed | dummy2 | |||
| ) |
Definiert in Zeile 1205 der Datei MGtool.c.
Benutzt _query_short().
01206 { 01207 return _query_short(); 01208 }

| static string ObjFile | ( | object | obj | ) | [static] |
Definiert in Zeile 310 der Datei MGtool.c.
Benutzt short_path().
Wird benutzt von _query_long(), _query_short(), id(), Inheritance(), PlayerWho(), PrintShort() und write_newinvobj().
00311 { 00312 return "["+short_path(object_name(obj))+"]"; 00313 }


| varargs int ParseLine | ( | string | str | ) |
Definiert in Zeile 1482 der Datei MGtool.c.
Benutzt call_out(), CallFunc(), ExplodeCmds(), FALSE, GetFunc(), NULL, PIPE_FILE, pipe_if, pipe_in, pipe_of, pipe_out, pipe_ovr, QuoteLine(), SafeReturn, strip_string(), TK(), TRUE, UnquoteLine() und WDLN.
01483 { 01484 string verb, arg; 01485 int ret; 01486 01487 TK("ParseLine: str: "+(str?str:"")); 01488 if(!sizeof(cmds)) 01489 { 01490 // this is a single command or beginning of a command pipe 01491 verb=query_verb(); 01492 01493 // return on unknown commands 01494 if(!verb||!strlen(verb)||!GetFunc(verb,TRUE)) 01495 return FALSE; 01496 01497 str=(string)this_player()->_unparsed_args(); 01498 pipe_in=FALSE; 01499 pipe_of=NULL; 01500 pipe_ovr=TRUE; 01501 pipe_out=FALSE; 01502 pipe_of=NULL; 01503 // pass arguments to some special functions unparsed 01504 if(member(({"xlpc","xcall","xeval"}),verb)>=0) 01505 { 01506 #ifdef XDBG 01507 TK("ParseLine: special func: "+verb); 01508 #endif 01509 ret=CallFunc(verb,str); 01510 SafeReturn(ret); 01511 } 01512 // ok, here we go 01513 pipe_in=pipe_out=FALSE; 01514 pipe_if=pipe_of=NULL; 01515 pipe_ovr=TRUE; 01516 if(file_size(PIPE_FILE)>=0) 01517 rm(PIPE_FILE); 01518 if (str&&str!="") 01519 { 01520 if(!(str=QuoteLine(str))) 01521 { 01522 WDLN("Unterminated quotation"); 01523 SafeReturn(TRUE); 01524 } 01525 cmds=ExplodeCmds(str); 01526 } 01527 else 01528 cmds=({""}); 01529 arg=strip_string(cmds[0]); 01530 } 01531 else 01532 { 01533 cmds[0]=strip_string(cmds[0]); 01534 TK("ParseLine: cmds[0]: "+cmds[0]); 01535 if(sscanf(cmds[0],"%s %s",verb,arg)!=2) 01536 { 01537 verb=cmds[0]; 01538 arg=""; 01539 } 01540 } 01541 cmds=cmds[1..]; 01542 TK("ParseLine: verb: "+verb); 01543 if (!verb||!strlen(verb)||!GetFunc(verb,TRUE)) 01544 SafeReturn(FALSE); 01545 TK("ParseLine(1): arg: "+arg+" cmds: "+sprintf("%O",cmds)); 01546 switch(sizeof(cmds)) 01547 { 01548 case 0: 01549 ret=CallFunc(verb,strip_string(UnquoteLine(arg))); 01550 SafeReturn(ret); 01551 break; 01552 01553 case 1: 01554 WDLN("Missing rhs of command pipe"); 01555 SafeReturn(TRUE); 01556 break; 01557 01558 default: 01559 pipe_out=TRUE; 01560 switch(cmds[0]) 01561 { 01562 case "|": 01563 pipe_of=PIPE_FILE; 01564 pipe_ovr=TRUE; 01565 cmds=cmds[1..]; 01566 break; 01567 01568 case ">": 01569 pipe_ovr=TRUE; 01570 if(sizeof(cmds)!=2) 01571 { 01572 WDLN("Illegal IO redirection"); 01573 SafeReturn(TRUE); 01574 } 01575 pipe_of=cmds[1]; 01576 cmds=({}); 01577 break; 01578 01579 case ">>": 01580 pipe_ovr=FALSE; 01581 if(sizeof(cmds)!=2) 01582 { 01583 WDLN("Illegal IO redirection"); 01584 SafeReturn(TRUE); 01585 } 01586 pipe_of=cmds[1]; 01587 cmds=({}); 01588 break; 01589 } 01590 } 01591 TK("ParseLine(2): arg: "+arg+" cmds: "+sprintf("%O",cmds)); 01592 if(!CallFunc(verb,strip_string(arg))) 01593 SafeReturn(FALSE); 01594 pipe_in=pipe_out; 01595 pipe_if=pipe_of; 01596 pipe_ovr=FALSE; 01597 pipe_out=FALSE; 01598 pipe_of=NULL; 01599 if(sizeof(cmds)) 01600 call_out("ParseLine",0); 01601 else 01602 SafeReturn(TRUE); 01603 return TRUE; 01604 }

| static string PlayerAge | ( | object | obj | ) | [static] |
Definiert in Zeile 964 der Datei MGtool.c.
Benutzt ARIGHT, NULL und P_AGE.
Wird benutzt von PlayerWho().
00965 { 00966 string str; 00967 int i, tmp; 00968 00969 if(!obj) 00970 return NULL; 00971 i=(int)obj->QueryProp(P_AGE); 00972 str=" "+ARIGHT(""+(i/43200), 3, "."); 00973 i-=(i/43200)*43200; 00974 return str+":"+ARIGHT(""+(i/1800), 2, "0"); 00975 }

| static string PlayerCmdAvg | ( | object | obj, | |
| int | flag | |||
| ) | [static] |
| static string PlayerDomain | ( | object | obj, | |
| int | flag | |||
| ) | [static] |
Definiert in Zeile 1032 der Datei MGtool.c.
Benutzt ALEFT, CAP, crname(), domains und MASTER.
01033 { 01034 int i, s; 01035 mixed *uinfo; 01036 string *domains, pre; 01037 01038 pre=(flag) ? ALEFT(crname(obj)+" ", 12, ".")+" " : ""; 01039 pre+="domainlord of: "; 01040 uinfo=(mixed*)MASTER->get_userinfo(getuid(obj)); 01041 if(uinfo&&(domains=uinfo[3])&&(s=sizeof(domains))) 01042 { 01043 for(i=0; i<s; i++) 01044 { 01045 pre += CAP(domains[i]); 01046 if(i<s-1) 01047 pre += ", "; 01048 } 01049 } 01050 return pre; 01051 }

| static string PlayerIdle | ( | object | obj | ) | [static] |
Definiert in Zeile 946 der Datei MGtool.c.
Wird benutzt von PlayerWho().
00947 { 00948 string str; 00949 int i, tmp; 00950 00951 if(!obj) 00952 return NULL; 00953 if((i=query_idle(obj))>=60) 00954 { 00955 str=ARIGHT(""+(i/3600), 2, "0"); 00956 i-=(i/3600)*3600; 00957 str+="'"+ARIGHT(""+(i/60), 2, "0"); 00958 } 00959 else 00960 str="....."; 00961 return str; 00962 }

| static string PlayerIP | ( | object | obj, | |
| int | flag | |||
| ) | [static] |
Definiert in Zeile 1014 der Datei MGtool.c.
Benutzt ALEFT, crname(), query_ip_name() und query_ip_number().
01015 { 01016 string pre; 01017 01018 pre=(flag) ? ALEFT(crname(obj)+" ", 12, ".")+" " : ""; 01019 return pre+"host: "+query_ip_name(obj)+" ("+query_ip_number(obj)+")"; 01020 }

| static string PlayerMail | ( | object | obj, | |
| int | flag | |||
| ) | [static] |
Definiert in Zeile 1006 der Datei MGtool.c.
Benutzt ALEFT, crname() und P_MAILADDR.
01007 { 01008 string pre; 01009 01010 pre=(flag) ? ALEFT(crname(obj)+" ", 12, ".")+" " : ""; 01011 return pre+"mail: "+obj->QueryProp(P_MAILADDR); 01012 }

| static string PlayerRace | ( | object | obj, | |
| int | flag | |||
| ) | [static] |
Definiert in Zeile 1022 der Datei MGtool.c.
Benutzt ALEFT, crname(), P_GUILD und P_RACE.
01023 { 01024 string tmp, pre; 01025 01026 pre=(flag) ? ALEFT(crname(obj)+" ", 12, ".")+" " : ""; 01027 pre=pre+"race: "+ALEFT(obj->QueryProp(P_RACE)+" ", 10, ".")+" guild: "; 01028 tmp=(string)obj->QueryProp(P_GUILD); 01029 return tmp ? pre+tmp : pre+"- none -"; 01030 }

| static string PlayerSnoop | ( | object | obj, | |
| int | flag | |||
| ) | [static] |
Definiert in Zeile 1070 der Datei MGtool.c.
Benutzt ALEFT, ARIGHT, crname() und query_snoop().
01071 { 01072 string tmp, pre; 01073 object victim; 01074 01075 pre=(flag) ? ALEFT(crname(obj)+" ", 12, ".")+" " : ""; 01076 pre=pre+"is snooped by: "; 01077 if(victim=query_snoop(obj)) 01078 pre+=ARIGHT(" "+crname(victim), 12, "."); 01079 else 01080 pre+="............"; 01081 return pre; 01082 }

| static string PlayerStats | ( | object | obj, | |
| int | flag | |||
| ) | [static] |
Definiert in Zeile 1053 der Datei MGtool.c.
Benutzt ALEFT, ARIGHT, crname(), P_DRINK, P_FOOD, P_HP, P_MAX_DRINK, P_MAX_FOOD, P_MAX_HP, P_MAX_SP, P_SP und P_XP.
01054 { 01055 string pre; 01056 01057 pre=(flag) ? ALEFT(crname(obj)+" ", 12, ".")+" " : ""; 01058 pre+="hp="+ARIGHT(obj->QueryProp(P_HP), 3, "0"); 01059 pre+="/"+ARIGHT(obj->QueryProp(P_MAX_HP), 3, "0"); 01060 pre+=" sp="+ARIGHT(obj->QueryProp(P_SP), 3, "0"); 01061 pre+="/"+ARIGHT(obj->QueryProp(P_MAX_SP), 3, "0"); 01062 pre+=" food="+ARIGHT(obj->QueryProp(P_FOOD), 3, "0"); 01063 pre+="/"+ARIGHT(obj->QueryProp(P_MAX_FOOD), 3, "0"); 01064 pre+=" drink="+ARIGHT(obj->QueryProp(P_DRINK), 3, "0"); 01065 pre+="/"+ARIGHT(obj->QueryProp(P_MAX_DRINK), 3, "0"); 01066 pre+=" exps="+obj->QueryProp(P_XP); 01067 return pre; 01068 }

| static string PlayerWho | ( | object | obj | ) | [static] |
Definiert in Zeile 988 der Datei MGtool.c.
Benutzt ALEFT, ARIGHT, crname(), ENV, LEVEL, ObjFile(), P_AWAY, P_FROG, P_GENDER, P_GHOST, PlayerAge() und PlayerIdle().
00989 { 00990 object tmp; 00991 string str, stmp; 00992 str=ARIGHT(""+LEVEL(obj) , 3, " "); 00993 str+=ALEFT(" "+crname(obj)+" ", 12, "."); 00994 str+=PlayerAge(obj); 00995 str+=((int)obj->QueryProp(P_GENDER)==1 ? " m " : " f "); 00996 str+=(obj->QueryProp(P_FROG)) ? "f" : "."; 00997 str+=(obj->QueryProp(P_GHOST)) ? "g" : "."; 00998 str+=(obj->QueryProp(P_INVIS)) ? "i" : "."; 00999 str+=(query_editing(obj)||query_input_pending(obj) ? "e" : "."); 01000 str+=(obj->QueryProp(P_AWAY)) ? "a" : "."; 01001 str+=" "+PlayerIdle(obj)+" "; 01002 str+=(tmp=ENV(obj)) ? ObjFile(tmp) : "- fabric of space -"; 01003 return str; 01004 }

| static string PrepareLine | ( | string | str | ) | [static] |
| static void PrintObj | ( | object | obj, | |
| string | file | |||
| ) | [static] |
Definiert in Zeile 264 der Datei MGtool.c.
Benutzt ARIGHT, FORALL, i, IS_ARCH, item, P_INT_LONG, P_LONG, PrintShort(), SECURE1, W und WLN.
00265 { 00266 object item, tmp; 00267 string str; 00268 int i; 00269 00270 SECURE1(); 00271 if(!obj) 00272 return; 00273 PrintShort("Short: ", obj, file); 00274 if(!file||file=="") 00275 WLN("Long :"); 00276 else 00277 write_file(file,"Long :\n"); 00278 if(query_once_interactive(obj)) 00279 str=capitalize(getuid(obj)); 00280 else 00281 { 00282 if(object_name(obj)[0..26]=="/d/unterwelt/objekte/teddy#" && 00283 IS_ARCH(this_interactive())) 00284 str="Ein Teddy (stumm)"; 00285 else 00286 { 00287 if(str=(string)obj->QueryProp(P_INT_LONG)) 00288 ; 00289 else if(str=(string)obj->QueryProp(P_LONG)) 00290 ; 00291 else 00292 str="- no long description -\n"; 00293 } 00294 } 00295 if(!file||file=="") 00296 W(str); 00297 else 00298 write_file(file,str); 00299 FORALL(item, obj) 00300 { 00301 if(!i) 00302 if(!file||file=="") 00303 WLN("Content:"); 00304 else 00305 write_file(file,"Content:\n"); 00306 PrintShort(ARIGHT(++i+". ", 4, " "), item, file); 00307 } 00308 }

| static varargs void PrintShort | ( | string | pre, | |
| object | obj, | |||
| string | file | |||
| ) | [static] |
Definiert in Zeile 315 der Datei MGtool.c.
Benutzt ALEFT, CAP, CRNAME, is_player(), MODE, MODE_SHORT, ObjFile(), P_INT_SHORT, P_SHORT, SECURE1, shadow(), SUBSTR und WLN.
Wird benutzt von DeepPrintShort() und PrintObj().
00316 { 00317 string str; 00318 00319 SECURE1(); 00320 if(!obj) 00321 return; 00322 if(MODE(MODE_SHORT)) 00323 { 00324 if (query_once_interactive(obj)) 00325 str=capitalize(getuid(obj)); 00326 else 00327 { 00328 if(!((str=(string)obj->QueryProp(P_INT_SHORT))|| 00329 (str=(string)obj->QueryProp(P_SHORT)))) 00330 if(is_player(obj)) 00331 str=CRNAME(obj)+" (invisible)"; 00332 else 00333 str="- no short description -"; 00334 } 00335 str=ALEFT(sprintf("%O ",str), 34, ".")+" "; 00336 } 00337 else 00338 str=""; 00339 if(interactive(obj)) 00340 str+="i"; 00341 else if(living(obj)) 00342 str+="l"; 00343 else 00344 str+="."; 00345 str+=(shadow(obj, 0) ? "s" : "."); 00346 if(!file||file=="") 00347 WLN(SUBSTR(pre+CAP(str)+" "+ObjFile(obj), 0, 79)); 00348 else 00349 write_file(file,SUBSTR(pre+CAP(str)+" "+ObjFile(obj), 0, 79)+"\n"); 00350 }


| static string propflags | ( | string | key, | |
| object | ob | |||
| ) | [static] |
Definiert in Zeile 403 der Datei MGtool.c.
Benutzt flags, NOSETMETHOD, PROTECTED, QUERYCACHED, QUERYMNOTFOUND, SAVE, SECURED, SETCACHED und SETMNOTFOUND.
Wird benutzt von dprop2().
00404 { 00405 int tmp; 00406 string *flags; 00407 tmp=(int)ob->Query(key,1); 00408 flags=({}); 00409 tmp&SAVE ? flags+=({"SAV"}) : flags+=({" "}); 00410 tmp&PROTECTED ? flags+=({"PRO"}) : flags+=({" "}); 00411 tmp&SECURED ? flags+=({"SEC"}) : flags+=({" "}); 00412 tmp&NOSETMETHOD ? flags+=({"NSM"}) : flags+=({" "}); 00413 tmp&SETMNOTFOUND ? flags+=({"SMN"}) : flags+=({" "}); 00414 tmp&QUERYMNOTFOUND ? flags+=({"QMN"}) : flags+=({" "}); 00415 tmp&QUERYCACHED ? flags+=({"QCA"}) : flags+=({" "}); 00416 tmp&SETCACHED ? flags+=({"SCA"}) : flags+=({" "}); 00417 return ""+implode(flags,"|"); 00418 }

| static mixed propmethods | ( | string | key, | |
| object | ob | |||
| ) | [static] |
| static string QuoteLine | ( | string | str | ) | [static] |
Definiert in Zeile 1409 der Datei MGtool.c.
Benutzt len, NULL, string_replace, TK() und XFindObj().
Wird benutzt von ParseLine().
01410 { 01411 string *tmp,*tmp2; 01412 int i, i2, len, len2, qd, qs; 01413 01414 str=string_replace(str,"\\\\","°BSHL"); 01415 str=string_replace(str,"\\\"","°DBLQ"); 01416 str=string_replace(str,"\\\'","°SGLQ"); 01417 str=string_replace(str,"\\|","°PIPE"); 01418 str=string_replace(str,"||","°OROR"); 01419 str=string_replace(str,"->","°LARR"); 01420 str=string_replace(str,"\\$","°DOLR"); 01421 tmp=regexplode(str,"(\"|')"); 01422 len=sizeof(tmp); 01423 qd=qs=0; 01424 for(i=0;i<len;i++) 01425 { 01426 if(i%2) 01427 { 01428 if(tmp[i]=="'") 01429 qd=(!qs?!qd:qd); 01430 else 01431 qs=(!qd?!qs:qs); 01432 if((tmp[i]=="\""&&!qd)||(tmp[i]=="'"&&!qs)) 01433 tmp[i]=""; 01434 } 01435 else 01436 { 01437 if(!qd) 01438 { 01439 len2=sizeof(tmp2=regexplode(tmp[i],"\\$[^ ][^ ]*")); 01440 for(i2=0;i2<len2;i2++) 01441 if(i2%2) 01442 { 01443 TK("QuoteLine: "+tmp2[i2][1..]); 01444 tmp2[i2]=(string)XFindObj((tmp2[i2])[1..]); 01445 } 01446 tmp[i]=implode(tmp2,""); 01447 } 01448 } 01449 } 01450 if(qd||qs) 01451 return NULL; 01452 str=implode(tmp,""); 01453 TK("QuoteLine: str: "+str); 01454 return str; 01455 }


| static int security | ( | ) | [static] |
Definiert in Zeile 86 der Datei MGtool.c.
Benutzt cloner, FALSE, IS_ARCH, ME, NULL, PREV, process_call(), query_wiz_level(), ROOTID, secure_level(), TK() und TRUE.
00087 { 00088 object prev; 00089 00090 if( process_call() || getuid()!=getuid(cloner) ) return FALSE; // Rumata 00091 00092 TK("UID: "+getuid(ME)+" cloner:"+getuid(cloner)); 00093 // TK("prev: "+object_name(PREV)+" me:"+object_name(ME)); 00094 if(prev=PREV) 00095 { 00096 if(!cloner) 00097 return TRUE; 00098 if(getuid(prev)==ROOTID||IS_ARCH(prev)) 00099 return TRUE; 00100 if(prev==ME) 00101 return TRUE; 00102 return secure_level()>=query_wiz_level(cloner); // Rumata 00103 //return getuid(prev)==getuid()&&geteuid(prev)==geteuid()&&cloner==RTP; 00104 } 00105 else 00106 return cloner==NULL; 00107 }

| string short | ( | ) |
Definiert in Zeile 1165 der Datei MGtool.c.
Benutzt _query_short().
01166 { 01167 return _query_short()+".\n"; 01168 }

| static string sread_line | ( | int | num | ) | [static] |
Definiert in Zeile 808 der Datei MGtool.c.
Benutzt file_time() und morefile.
Wird benutzt von CatFile().
00809 { 00810 if (!morefile) return ""; 00811 if (last_file!=morefile || last_file_date!=file_time(morefile)) { 00812 if (!(last_file=read_bytes(morefile, 0, 50000))) return ""; 00813 last_file_date=file_time(morefile); 00814 last_file_buffer=explode(last_file, "\n"); 00815 last_file_size=sizeof(last_file_buffer); 00816 if (strlen(last_file)==50000 && last_file[<1]!='\n') { 00817 last_file_size--; // letzte Zeile nicht vollstaendig gelesen 00818 last_file_complete=0; 00819 } 00820 else if (file_size(morefile)>50000) 00821 last_file_complete=0; 00822 else last_file_complete=1; 00823 last_file=morefile; 00824 } 00825 if (num==0) num=1; 00826 // bei zu grossen Files nicht mehr alles buffern... 00827 if (num>last_file_size) { 00828 if (last_file_complete) return ""; 00829 return (read_file(morefile, num, 1) || ""); 00830 } 00831 return last_file_buffer[num-1]+"\n"; 00832 }


| static object* SubNodes | ( | object | obj | ) | [static] |
Definiert in Zeile 531 der Datei MGtool.c.
Benutzt NULL.
Wird benutzt von Inheritance().
00532 { 00533 int s; 00534 object *objs; 00535 string *inlist; 00536 00537 if(!obj) 00538 return NULL; 00539 inlist=inherit_list(obj); 00540 s=sizeof(inlist); 00541 objs=({}); 00542 while(s-->1) 00543 objs=({find_object(inlist[s])})+objs; 00544 return objs; 00545 }

| void TK | ( | string | str | ) |
Definiert in Zeile 1300 der Datei MGtool.c.
Wird benutzt von CallFunc(), Command(), GetFunc(), ParseLine(), QuoteLine(), security(), UnquoteLine(), Xcall(), Xcallouts(), Xcat(), Xcd(), Xclean(), Xcmds(), Xdbg(), Xdclean(), Xddes(), Xdes(), Xdlook(), Xecho(), XFile(), XFindFile(), XFindObj(), Xgrep(), XGrepFile(), Xhbeats(), Xhead(), Xids(), Xinfo(), Xinherit(), Xinventory(), Xlook(), Xmore(), Xmsg(), Xprops(), Xsort(), Xtail(), Xtool(), Xwc() und Xwho().

| static string UnquoteLine | ( | string | str | ) | [static] |
Definiert in Zeile 1457 der Datei MGtool.c.
Benutzt string_replace und TK().
Wird benutzt von ParseLine().
01458 { 01459 str=string_replace(str,"°BSHL","\\"); 01460 str=string_replace(str,"°DBLQ","\""); 01461 str=string_replace(str,"°SGLQ","\'"); 01462 str=string_replace(str,"°DQUO",""); 01463 str=string_replace(str,"°SQUO",""); 01464 str=string_replace(str,"°PIPE","|"); 01465 str=string_replace(str,"°OROR","||"); 01466 str=string_replace(str,"°LARR","->"); 01467 str=string_replace(str,"°DOLR","$"); 01468 TK("UnquoteLine: str: "+str); 01469 return str; 01470 }


| void update_tool | ( | mixed * | args, | |
| object | obj | |||
| ) |
Definiert in Zeile 1267 der Datei MGtool.c.
Benutzt _set_autoloadobj(), Destruct(), move(), PREV und SECURE1.
01268 { 01269 SECURE1(); 01270 if(!(obj&&args)) 01271 return; 01272 Destruct(PREV); 01273 _set_autoloadobj(args); 01274 move(obj); 01275 }

| static void VarCheck | ( | int | show | ) | [static] |
Definiert in Zeile 1701 der Datei MGtool.c.
Benutzt remove_alist(), variable und WDLN.
01702 { 01703 int i, s; 01704 01705 for(i=0, s=sizeof(variable[0]); i<s; i++) 01706 { 01707 if(variable[1][i]) continue; 01708 if(show) WDLN("*** Variable $"+variable[0][i]+" has been destructed"); 01709 variable=remove_alist(variable[0][i], variable); 01710 i--;s--; 01711 } 01712 }

| static string VarToFile | ( | string | str | ) | [static] |
Definiert in Zeile 250 der Datei MGtool.c.
Benutzt source_file_name und VarToObj().
00251 { 00252 return source_file_name(VarToObj(str)); 00253 }

| static object VarToObj | ( | string | str | ) | [static] |
Definiert in Zeile 232 der Datei MGtool.c.
Benutzt cloner, ENV, NULL, SUBSTR und variable.
Wird benutzt von FindObj(), VarToFile() und VarToPureFile().
00233 { 00234 if(!(str&&str[0]=='$')) 00235 return NULL; 00236 switch(str) 00237 { 00238 case "$m": 00239 case "$me": 00240 return cloner; 00241 case "$h": 00242 case "$here": 00243 return ENV(cloner); 00244 default: 00245 return assoc(SUBSTR(str, 1, -1), variable); 00246 } 00247 return(NULL); //never reached 00248 }

| static string VarToPureFile | ( | string | str | ) | [static] |
Definiert in Zeile 255 der Datei MGtool.c.
Benutzt pure_file_name und VarToObj().
00256 { 00257 return pure_file_name(VarToObj(str)); 00258 }

| static int Write | ( | string | str | ) | [static] |
| int write_newinvobj | ( | object | obj | ) |
Definiert in Zeile 1715 der Datei MGtool.c.
Wird benutzt von InsertNotify().


| static void XExecFile | ( | int | line | ) | [static] |
Definiert in Zeile 897 der Datei MGtool.c.
Benutzt call_out(), Command(), EXEC_LINES, EXEC_TIME, NULL, scriptline und scriptsize.
00898 { 00899 int i; 00900 00901 if(!scriptline) 00902 return; 00903 for(i=line; i<scriptsize&&i<line+EXEC_LINES; i++) 00904 { 00905 if(!scriptline[i]) 00906 continue; 00907 if(!Command(scriptline[i])) 00908 { 00909 scriptline=NULL; 00910 return; 00911 } 00912 } 00913 if(i<scriptsize) 00914 call_out("XExecFile", EXEC_TIME, i); 00915 else 00916 scriptline=NULL; 00917 }

| static string XFile | ( | string | file | ) | [static] |
Definiert in Zeile 580 der Datei MGtool.c.
Benutzt long_path(), NULL, old_explode(), source_file_name, SUBSTR, TK() und XFindObj().
Wird benutzt von XFindFile().
00581 { 00582 TK("XFile: file: "+(file?file:"(NULL)")); 00583 if(file) 00584 switch(file[0]) 00585 { 00586 case '@': 00587 return source_file_name(XFindObj(SUBSTR(file, 1, -1))); 00588 case '$': 00589 return source_file_name(XFindObj(file)); 00590 default: 00591 return old_explode(long_path(file),"#")[0]; 00592 } 00593 return NULL; 00594 }


| static string XFindFile | ( | string | file | ) | [static] |
Definiert in Zeile 596 der Datei MGtool.c.
Benutzt NULL, short_path(), SUBSTR, TK(), WDLN und XFile().
00597 { 00598 TK("XFindFile: file: "+(file?file:"(NULL)")); 00599 if(file=XFile(file)) 00600 { 00601 if(file_size(file)>=0) 00602 return file; 00603 if(SUBSTR(file, -3, -1)!=".c"&&file_size(file+".c")>0) 00604 return file+".c"; 00605 } 00606 WDLN("File not found or not readable ["+short_path(file)+"]"); 00607 return NULL; 00608 }

| static varargs object XFindObj | ( | string | str, | |
| int | silent | |||
| ) | [static] |
Definiert in Zeile 144 der Datei MGtool.c.
Benutzt cloner, cnt, ENV, env(), FindObj(), i, NULL, RNAME, string_replace, strip_explode() und TK().
Wird benutzt von QuoteLine() und XFile().
00145 { 00146 object obj, env; 00147 string *strs; 00148 int i, s, cnt; 00149 00150 if(!str) 00151 return NULL; 00152 TK("XFindObj: str: "+(str?str:"(NULL)")); 00153 env=ENV(cloner); 00154 str=string_replace(str, "\\.","°01"); 00155 str=string_replace(str, "\\^", "°02"); 00156 str=string_replace(str, "\\$", "°03"); 00157 str=string_replace(str, "\\\\", "\\"); 00158 if (find_object(str)) return find_object(str); 00159 if (file_size(str)>1) { 00160 call_other(str, "???"); 00161 return find_object(str); 00162 } 00163 s=sizeof(strs=strip_explode(str, ".")); 00164 while(s--) 00165 { 00166 if(strs[i]=="m"||strs[i]=="me") 00167 strs[i]=RNAME(cloner); 00168 else if(strs[i]=="h"||strs[i]=="here") 00169 strs[i]=object_name(ENV(cloner)); 00170 if(obj=FindObj(strs[i++],env,(silent?1:0))) 00171 env=obj; 00172 else 00173 break; 00174 } 00175 return obj; 00176 }


| static int XGrepFile | ( | string | pat, | |
| string | file, | |||
| int | mode | |||
| ) | [static] |
Definiert in Zeile 856 der Datei MGtool.c.
Benutzt FALSE, i, SECURE2, strip_explode(), TK(), TMP_FILE, TRUE, XGREP_ICASE und XGREP_REVERT.
00857 { 00858 int i, j, f, s, fsize; 00859 string tfile, *tmp, *ts, t; 00860 00861 SECURE2(FALSE); 00862 TK("XGrepFile: pat: "+pat+" file: "+file+" mode: "+mode); 00863 if(!(pat&&file)) 00864 return FALSE; 00865 tfile=TMP_FILE; 00866 fsize=file_size(file); 00867 for(i=0,f=0; i<fsize && t=read_bytes(file, i, 50000); i+=50000) 00868 tmp=strip_explode(t,"\n"); 00869 if (t && t[<1]!='\n' && strlen(t)==50000) { 00870 i-=strlen(tmp[<1]); 00871 tmp=tmp[0..<2]; 00872 } 00873 if(s=sizeof(tmp)) 00874 { 00875 for(j=0;j<s;j++) 00876 { 00877 if(sizeof(ts=regexp(({(mode&XGREP_ICASE?lower_case(tmp[j]):tmp[j])}),pat))) 00878 { 00879 if(!(mode&XGREP_REVERT)) 00880 { 00881 if(!f++) 00882 write_file(tfile, "*** File: "+file+" ***\n"); 00883 write_file(tfile, tmp[j]+"\n"); 00884 } 00885 } 00886 else if(mode&XGREP_REVERT) 00887 { 00888 if(!f++) 00889 write_file(tfile, "*** File: "+file+" ***\n"); 00890 write_file(tfile, tmp[j]+"\n"); 00891 } 00892 } 00893 } 00894 return TRUE; 00895 }

| static void XMoreFile | ( | string | file, | |
| int | flag | |||
| ) | [static] |
Definiert in Zeile 614 der Datei MGtool.c.
Benutzt long_path(), MoreFile(), morefile, NULL, SECURE1 und WDLN.
00615 { 00616 int s,size; 00617 00618 SECURE1(); 00619 if(!file) 00620 return; 00621 00622 // term=(string)cloner->QueryProp(P_TTY)!="dumb"; 00623 if((size=(file_size(morefile=long_path(file))))>0) 00624 { 00625 if(size>100000) 00626 WDLN("Warning: large file"); 00627 MoreFile(NULL); 00628 } 00629 else if(flag) 00630 WDLN("Cannot read file"); 00631 }

| static void XMsgSay | ( | string | str | ) | [static] |
Definiert in Zeile 1097 der Datei MGtool.c.
Benutzt input_to() und WLN.
01098 { 01099 if(str=="."||str=="**") 01100 { 01101 WLN("[End of message]"); 01102 say("[End of message]\n"); 01103 } 01104 else 01105 { 01106 say(str+"\n"); 01107 input_to("XMsgSay"); 01108 } 01109 }

| static void XMsgShout | ( | string | str | ) | [static] |
Definiert in Zeile 1125 der Datei MGtool.c.
Benutzt input_to(), shout() und WLN.
01126 { 01127 if(str=="."||str=="**") 01128 { 01129 WLN("[End of message]"); 01130 shout("[End of message]\n"); 01131 } 01132 else 01133 { 01134 shout(str+"\n"); 01135 input_to("XMsgShout"); 01136 } 01137 }

| static void XMsgTell | ( | string | str | ) | [static] |
Definiert in Zeile 1111 der Datei MGtool.c.
Benutzt input_to(), msgto und WLN.
01112 { 01113 if(str=="."||str=="**") 01114 { 01115 WLN("[End of message]"); 01116 tell_object(msgto, "[End of message]\n"); 01117 } 01118 else 01119 { 01120 tell_object(msgto, str+"\n"); 01121 input_to("XMsgTell"); 01122 } 01123 }

| static void XmtpScript | ( | string | dir, | |
| string | file, | |||
| string | opt | |||
| ) | [static] |
Definiert in Zeile 919 der Datei MGtool.c.
00920 { 00921 int s, t; 00922 string *files; 00923 00924 s=sizeof(files=get_dir(dir+"/*")); 00925 while(s--) 00926 { 00927 t=strlen(files[s])-1; 00928 if(files[s] == ".." || files[s] == "." || files[s][t] == '~' || 00929 (files[s][0] == '#' && files[s][t] == '#')) 00930 continue; 00931 if(file_size(dir+"/"+files[s])==-2) 00932 { 00933 write_file(file, "mkdir "+files[s]+" ; cd "+files[s]+"\n"); 00934 XmtpScript(dir+"/"+files[s], file, opt); 00935 write_file(file, "cd ..\n"); 00936 } 00937 else 00938 write_file(file, "mtp -r "+opt+" "+dir+"/"+files[s]+"\n"); 00939 } 00940 }
| int Xtk | ( | string | str | ) |
object cloner [static] |
Definiert in Zeile 34 der Datei MGtool.c.
Wird benutzt von _query_long(), _query_short(), actions(), add_insert_hook(), Command(), CommandScan(), create(), DropObj(), init(), InsertNotify(), move(), security(), TK(), VarToObj(), Write(), Xcall(), Xcd(), Xclean(), Xclone(), Xcmds(), Xdclean(), Xdlook(), Xeval(), XFindObj(), Xgoto(), Xhbeats(), Xinventory(), Xlight(), Xlook(), Xlpc(), Xmsg(), Xquit(), Xset(), Xtool(), Xtrans() und Xuclone().
string* cmds [static] |
string * last_file_buffer [static] |
int last_file_complete [static] |
int last_file_date [static] |
int last_file_size [static] |
private mapping line_buffer = ([]) [static] |
private string line_buffer_name = "" [static] |
string* manpath [static] |
private string more_searchexpr = "" [static] |
string morefile = NULL [static] |
Definiert in Zeile 45 der Datei MGtool.c.
Wird benutzt von MoreFile(), sread_line() und XMoreFile().
int moreflag = FALSE [static] |
Definiert in Zeile 48 der Datei MGtool.c.
Wird benutzt von MoreFile().
int moreoffset = 1 [static] |
Definiert in Zeile 49 der Datei MGtool.c.
Wird benutzt von CatFile(), MoreFile() und Xmore().
object msgto = NULL [static] |
Definiert in Zeile 35 der Datei MGtool.c.
Wird benutzt von Xmsg() und XMsgTell().
int nostore = FALSE [static] |
Definiert in Zeile 52 der Datei MGtool.c.
Wird benutzt von Command(), CommandScan() und DoHistory().
string pipe_if = NULL [static] |
int pipe_in = FALSE [static] |
string pipe_of = NULL [static] |
Definiert in Zeile 58 der Datei MGtool.c.
Wird benutzt von dprop(), dprop2(), dprop3(), DumpProperties(), GetFunc(), Inheritance(), ParseLine(), Xcall(), Xcallouts(), Xcat(), Xcmds(), Xdlook(), Xeval(), Xgrep(), Xhbeats(), Xhead(), Xinherit(), Xinventory(), Xlook(), Xsort(), Xtail() und Xwho().
int pipe_out = FALSE [static] |
int pipe_ovr = TRUE [static] |
Definiert in Zeile 56 der Datei MGtool.c.
Wird benutzt von GetFunc(), ParseLine() und Xgrep().
| inherit std thing properties |
string* scriptline = NULL [static] |
Definiert in Zeile 46 der Datei MGtool.c.
Wird benutzt von XExecFile() und Xsh().
int scriptsize = NULL [static] |
Definiert in Zeile 51 der Datei MGtool.c.
Wird benutzt von XExecFile() und Xsh().
int term = NULL [static] |
Definiert in Zeile 50 der Datei MGtool.c.
Wird benutzt von MoreFile() und SetColorstrings().
mixed* variable = ({({}),({})}) [static] |
int xlight = 0 [static] |
Definiert in Zeile 53 der Datei MGtool.c.
Wird benutzt von _query_light(), _set_light() und Xlight().
1.6.3