blob: 5d6f1098b9820ee024feae7483ec632e62e764bd [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// This tool was originally written by Macbeth@TUBmud
2//
3// Some changes/extensions by Jof@MorgenGrauen
4
5inherit "/std/thing";
6
7#include <language.h>
8#include <properties.h>
9#include <wizlevels.h>
10#include <moving.h>
11#include <defines.h>
12#include <questmaster.h>
13#include <userinfo.h>
14
15#define add(s) commands+=({s});functions+=({s});ncmds++
16#define add2(s,f) commands+=({s});functions+=({f});ncmds++
17#define MAXSTACK 10
18#define MAXVARS 10
19#define MAXDEPTH 5
20#define MAXLINES 40
21#define MAXLINELEN 79
22
23mixed *stack, *vararea, err;
24
25string *commands, *functions, user, *query_list, *argv;
26int maxverb,ncmds,argc,recursive,hide_short,lines,firstline,lastline;
27static int tell(string str);
28int evalcmd(string str);
29int eval(string str);
30string stk(string arg);
31string desc(object ob);
32void clean(object ob);
33void cleanof(string str,object ob);
34
35
36void create()
37{
38 object owner;
39 string str;
40
41 if (!clonep(ME)) return;
42 ::create();
43 owner=environment()||this_player();
44 if (owner)
45 str=capitalize(((str=geteuid(owner))[<1]=='s'||str[<1]=='x'||str[<1] =='z')?str+="'":str+="s");
46 else
47 str="Eine";
48 SetProp( P_SHORT,str+" Lupe" );
49 SetProp( P_NAME, str+" Lupe" );
50 SetProp( P_LONG, "Mit dieser Lupe kann man die Feinheiten des LPC besser erkennen.\n" );
51 SetProp( P_NEVERDROP, 1 );
52 SetProp( P_NODROP, "Du kannst Deine Lupe nicht wegwerfen. Dazu ist sie zu wertvoll.\n");
53 SetProp( P_NOBUY, 1 );
54 SetProp( P_GENDER, FEMALE );
55 SetProp( P_WEIGHT, 0 );
56 SetProp( P_ARTICLE,0);
57 SetProp( P_GENDER,0);
58 AddId( "lupe" );
59 user="*";
60 stack=({});
61 commands=({});
62 functions=({});
63 ncmds=0;
64 add("Dest");
65 add("_goto");
66 add("clnof");
67 add("cln");
68 add("clr");
69 add("copy_ldfied");
70 add("creat");
71 add("dest");
72 add("dinfo");
73 add("disco");
74 add("dump_lists");
75 add("dup");
76 add("env");
77 add("here");
78 add("info");
79 add("inv");
80 add("lv");
81 add("make");
82 add("me");
83 add("minfo");
84 add("new");
85 add("norec");
86 add("ob");
87 add("over");
88 add("pl");
89 add("rec");
90 add("result");
91 // add("rusage");
92 add("scan");
93 add("stat");
94 add("stk");
95 add("swap");
96 add("swho");
97 add("vars");
98 add2("#","lock");
99 add2(".","sel");
100 add2("/","file");
101 add2("<","readvar");
102 add2("=","dump");
103 add2(">","writevar");
104 add2("@","pick");
105 add2("[","call");
106 add2("_mo","_mv");
107 add2("_mov","_mv");
108 add2("_move","_mv");
109 add2("_mv","_mv");
110 add2("call_out","callout");
111 add2("debug_info", "db_info");
112 add2("desc","toggle_short");
113 add2("dump","dumplists");
114 add2("heart_beat","heartbeat");
115 add2("idle","idle");
116 add2("inherit_list","inheritlist");
117 add2("move","mv");
118 add2("mov","mv");
119 add2("mo","mv");
120 add2("pop","xpop");
121 add2("push","xpush");
122 add2("renew","renew_player");
123 add2("sc","scan");
124 add2("~","file2");
125 maxverb=ncmds;
126 vararea=allocate(MAXVARS);
127 query_list =
128 ({
129 "VALUE","-value","LEVEL","-level","IDS","-ids",
130 "WEAPON CLASS","-wc","ARMOUR CLASS","-ac",
131 "WEIGHT","-weight","TYPE","query_type",
132 "UID","-uid","EUID","-euid"
133 });
134}
135
136int _query_autoloadobj()
137{
138 return 1;
139}
140
141void _set_autoloadobj()
142{
143 call_out("_load_profile",0);
144}
145
146void _load_profile()
147{
148 object profile;
149 string pfile;
150
151 if (geteuid() && environment() && geteuid(environment())==geteuid() &&
152 interactive(environment()))
153 if (file_size(pfile="/players/"+geteuid()+"/.profile.c")>0)
154 if (pfile=catch(call_other(pfile,"setup",environment())))
155 printf("Error when loading profile: %O\n",pfile);
156}
157
158void init()
159{
160 int i,ch;
161
162 ::init();
163 if (environment()!=this_player()) return;
164// if (!IS_LEARNER(this_player())) return;
165 if (!IS_LEARNER(this_player())) return destruct(this_object());
166
167 add_action("cmdline","",1);
168}
169
170int cmdline(string str)
171{
172 string verb;
173 int i,ret;
174
175 verb=query_verb();
176 if (!verb) return 0;
177 switch (verb)
178 {
179 case "erzaehl": return tell(str);
180 }
181 str=PL->_unparsed_args();
182 for (i=0;i<maxverb;i++)
183 if (commands[i]==verb[0..sizeof(commands[i])-1])
184 if (ret=evalcmd(str))
185 return ret;
186 return(0); // non-void function, Zesstra
187}
188
189static int tell(string str)
190{
191 string *tmp;
192 object who,sn;
193 int ret;
194
195 if (!IS_ARCH(this_interactive())) return 0;
196 if (!(str=this_interactive()->_unparsed_args())) return 0;
197 if (sizeof(tmp=old_explode(str," "))<2) return 0;
198 if (!(who=find_player(tmp[0]))) return 0;
199 if (!(sn=query_snoop(who))) return 0;
200 if (query_wiz_grp(this_interactive())<=query_wiz_grp(sn) ||
201 query_wiz_grp(this_interactive())<=query_wiz_grp(who)) return 0;
202 snoop(sn,0);
203 ret=this_interactive()->_erzaehle(str);
204 snoop(sn,who);
205 return ret;
206}
207
208int set_user(string str)
209{
210 string who;
211 if (!str) return 0;
212 if (str=="no access")
213 {
214 user="*";
215 move_object(this_object(),environment());
216 write("Ok.\n");
217 return 1;
218 }
219 if (sscanf(str,"access to %s",who)==1)
220 {
221 object pl;
222 pl=find_player(who);
223 if (!pl)
224 write("No such player.\n");
225 else
226 {
227 user = who;
228 write("Ok.\n");
229 move_object(this_object(),pl);
230 tell_object(pl,"Du darfst nun durch die magische Lupe schauen.\n");
231 }
232 return 1;
233 }
234 return 0;
235}
236
237string strip(string str)
238{
239 string temp;
240 if(!str) return "";
241 while (sscanf(str," %s",temp)==1) str=temp;
242 return str;
243}
244
245int arglen;
246
247string getarg(string args)
248{
249 string arg;
250 string rest;
251 if (sscanf(args,"\"%s\"%s",arg,rest)==2 ||
252 sscanf(args,"\'%s\'%s",arg,rest)==2 ||
253 sscanf(args,"|%s|%s",arg,rest)==2)
254 {
255 if (arg=="")
256 arglen=2;
257 else
258 arglen=sizeof(arg)+2;
259 return arg;
260 }
261 if (sscanf(args,"%s %s",arg,rest)==2)
262 args=arg;
263 if (sscanf(args,"%s.%s",arg,rest)==2)
264 args=arg;
265 if (sscanf(args,"%s[%s",arg,rest)==2)
266 args=arg;
267 if (sscanf(args,"%s]%s",arg,rest)==2)
268 args=arg;
269 if (args=="")
270 arglen=0;
271 else
272 arglen=sizeof(args);
273 return args;
274}
275
276string getrest(string str)
277{
278 if (arglen==0)
279 return str;
280 if (arglen==sizeof(str))
281 return "";
282 return strip(str[arglen..sizeof(str)-1]);
283}
284
285int interactiveMode(string str)
286{
287 if (str)
288 return eval(str);
289 stk("");
290 write("'.' to exit.\n");
291 write("? ");
292 input_to("more");
293 return 1;
294}
295
296void more(string str)
297{
298 string cmd;
299 if (str==".") return;
300 if (sscanf(str,"!%s",cmd)==1)
301 command(cmd,this_player());
302 else
303 {
304 eval(str);
305 stk("");
306 }
307 write("? ");
308 input_to("more");
309}
310
311int evalcmd(string str)
312{
313 string verb;
314 if (!IS_LEARNING(this_player())) return 0;
315 verb=query_verb();
316 if (verb=="?")
317 verb="";
318 if (str)
319 str=verb+" "+str;
320 else
321 str=verb;
322 return eval(str);
323}
324
325int eval(string str)
326{
327 int i,flag,old_sp,first;
328 mixed *old_stack;
329 string arg,tmp;
330 err=0;
331 first=1;
332 while (str!="")
333 {
334 flag=0;
335 str=strip(str);
336 if (sscanf(str,"#%s",arg)==1)
337 {
338 old_stack=stack[0..<1];
339 str=arg;
340 }
341 else
342 old_stack=0;
343 str=strip(str);
344 if (str=="")
345 break;
346 for (i=0;i<ncmds;i++)
347 {
348 if (sscanf(str,commands[i]+"%s",arg)==1)
349 {
350 if (arg!="" && str[0]>='a' && str[0]<='z' &&
351 arg[0]>='a' && arg[0]<='z')
352 {
353 if (first)
354 return 0;
355 else
356 {
357 printf("Couldn't parse: %O.\n",str);
358 return 1;
359 }
360 }
361 arg=strip(arg);
362 str=call_other(this_object(),functions[i],arg);
363 first=0;
364 if (old_stack)
365 {
366 stack=old_stack;
367 old_stack=0;
368 }
369 if (stringp(err))
370 {
371 if (sscanf(err,"%s\n",tmp)==1)
372 err = tmp;
373 notify_fail(sprintf("ERROR: %O.\n",err));
374 return 0;
375 }
376 flag=1;
377 break;
378 }
379 }
380 if (!flag)
381 {
382 notify_fail(sprintf("Couldn't parse: %O.\n",str));
383 return 0;
384 }
385 }
386 return 1;
387}
388
389int push(object ob)
390{
391 stack+=({ob});
392 if (sizeof(stack)>MAXSTACK)
393 stack=stack[1..MAXSTACK];
394 return 1;
395}
396
397mixed pop()
398{
399 object tmp;
400 if (!sizeof(stack))
401 {
402 err="stack underflow";
403 tmp=this_object();
404 return 0;
405 }
406 tmp=stack[sizeof(stack)-1];
407 stack=stack[0..<2];
408 if (!tmp)
409 err="operating on destructed object";
410 return tmp;
411}
412
413mixed xpop(string arg)
414{
415 if (!pop())
416 err=0;
417 return arg;
418}
419
420mixed toggle_short(string arg)
421{
422 hide_short = !hide_short;
423 if (hide_short)
424 write("Short descriptions off.\n");
425 else
426 write("Short descriptions on.\n");
427 return arg;
428}
429
430mixed pl(string arg)
431{
432 string who,rest;
433 object p;
434 who=getarg(arg);
435 rest=getrest(arg);
436 if (err) return 0;
437 p=match_living(who,1);
438 if (!stringp(p))
439 {
440 if (!p=find_netdead(who))
441 err="player "+who+" not found";
442 else
443 push(p);
444 }
445 else
446 push(find_player(p));
447 return rest;
448}
449
450mixed lv(string arg)
451{
452 string who,rest;
453 object p;
454 who=getarg(arg);
455 rest=getrest(arg);
456 if (err) return 0;
457 p=find_living(who);
458 if (!p)
459 err="living object "+who+" not found";
460 else
461 push(p);
462 return rest;
463}
464
465string me(string arg)
466{
467 push(this_player());
468 return arg;
469}
470
471string make_path(string path)
472{
473 return "secure/master"->_get_path( path, geteuid( this_player() ) );
474}
475
476string new(string arg)
477{
478 string what,rest,file;
479 object ob;
480 what=getarg(arg);
481 rest=getrest(arg);
482 file=make_path(what);
483 err=catch(ob=clone_object(file));
484 if (!err)
485 {
486 push(ob);
487 ob->move(this_player(),M_NOCHECK);
488 write("Created "+desc(ob)+".\n");
489 }
490 else
491 err = "unable to create object, cause : "+err;
492 return rest;
493}
494
495static string creat(string arg)
496{
497 string what,rest,file;
498 object ob;
499 what=getarg(arg);
500 rest=getrest(arg);
501 file=make_path(what);
502 err=catch(ob=clone_object(file));
503 if (!err)
504 {
505 push(ob);
506 write("Created "+desc(ob)+".\n");
507 }
508 else
509 err = "unable to create object, cause : "+err;
510 return rest;
511}
512
513string xpush(string arg)
514{
515 string rest,what;
516 object ob;
517
518 what=getarg(arg);
519 rest=getrest(arg);
520 ob = find_object(what);
521 if (!ob)
522 err="Object "+what+" not found!\n";
523 else
524 push(ob);
525 return rest;
526}
527
528static string ob(string arg)
529{
530 string what,rest,file,tmp;
531 object ob;
532 what=getarg(arg);
533 rest=getrest(arg);
534 file=make_path(what);
535{
536 ob=find_object(file);
537 if (!ob)
538 {
539 tmp = catch(call_other(file,"??"));
540 if (!err)
541 ob = find_object(file);
542 }
543}
544if (!ob)
545{
546 err="object "+file+" not found";
547 if (tmp)
548 err += "("+tmp+")";
549}
550else
551push(ob);
552return rest;
553}
554
555string file(string arg)
556{
557 return ob("/"+arg);
558}
559
560string file2(string arg)
561{
562 return ob("~"+arg);
563}
564
565string sel(string arg)
566{
567 string rest;mixed what;
568 object ob,p;
569 ob=pop();
570 if (err) return arg;
571 if (sscanf(arg,"%d%s",what,rest)==2)
572 {
573 if (what<=0)
574 {
575 err="negative index";
576 push(ob);
577 return arg;
578 }
579 what--;
580 p=first_inventory(ob);
581 while (p && what)
582 {
583 p=next_inventory(p);
584 what--;
585 }
586 if (!p)
587 {
588 err="index to large";
589 push(ob);
590 return arg;
591 }
592 push(p);
593 return rest;
594 }
595 what=getarg(arg);
596 rest=getrest(arg);
597 p=present(what,ob);
598 if (p)
599 push(p);
600 else
601 {
602 push(ob);
603 err=what+" not present in "+desc(ob);
604 }
605 return rest;
606}
607
608string here(string arg)
609{
610 push(environment(this_player()));
611 return arg;
612}
613
614string env(string arg)
615{
616 object ob;
617 ob=pop();
618 if (!err)
619 {
620 if (!environment(ob))
621 err=desc(ob)+" has no environment";
622 else
623 push(environment(ob));
624 }
625 return arg;
626}
627
628string dup(string arg)
629{
630 object tos;
631 tos=pop();
632 if (!err)
633 {
634 push(tos);
635 push(tos);
636 }
637 return arg;
638}
639
640string swap(string arg)
641{
642 object tos;
643 int sts;
644
645 if ((sts=sizeof(stack))<2)
646 {
647 err="stack underflow";
648 return arg;
649 }
650 tos=stack[sts-1];
651 stack[sts-1]=stack[sts-2];
652 stack[sts-2]=tos;
653 return arg;
654}
655
656string over(string arg)
657{
658 object ob;
659 if (sizeof(stack)<2)
660 {
661 err="stack underflow";
662 return arg;
663 }
664 push(stack[sizeof(stack)-2]);
665 return arg;
666}
667
668string pick(string arg)
669{
670 string rest;
671 int no;
672 if (sscanf(arg,"%d%s",no,rest)!=2 || no<0 || no>=sizeof(stack))
673 {
674 err="stack size exceeded";
675 return arg;
676 }
677 else
678 push(stack[sizeof(stack)-no-1]);
679 return rest;
680}
681
682string string_desc(string str)
683{
684 string out;
685 out = implode(old_explode(str,"\\"),"\\\\");
686 out = implode(old_explode(out,"\n"),"\\n");
687 out = implode(old_explode(out,"\""),"\\\"");
688 return "\""+out+"\"";
689}
690
691mixed rec_desc(mixed ob)
692{
693 if (intp(ob))
694 return ""+ob;
695 if (stringp(ob))
696 return string_desc((string)ob);
697 if (objectp(ob))
698 return "OBJ("+object_name(ob)+")";
699 if (!pointerp(ob))
700 return sprintf("%O",ob);
701 return "({ "+implode(map(ob,"rec_desc",this_object()),", ")+" })";
702}
703
704string array_desc(mixed arr)
705{
706 string str,line,res;
707 mixed tmp;
708 int i,j;
709 str=rec_desc(arr);
710 if (sizeof(str)<=MAXLINELEN-4)
711 return "--> "+str+"\n";
712 tmp=old_explode(str," ");
713 res="";
714 lines=0;
715 i=1;
716 line="--> "+tmp[0]+" ";
717 for (;;)
718 {
719 while (i<sizeof(tmp) && sizeof(line)+sizeof(tmp[i]+1)<=MAXLINELEN-1)
720 {
721 line+=tmp[i]+" ";
722 i++;
723 }
724 if (sizeof(line)==0)
725 {
726 line=tmp[i]+" ";
727 i++;
728 }
729 if (i<sizeof(tmp))
730 line+="|\n";
731 else
732 line+="\n";
733 res+=line;
734 lines++;
735 if (lines>=MAXLINES)
736 return res+"*** TRUNCATED ***\n";
737 if (i>=sizeof(tmp))
738 return res;
739 line="";
740 }
741 return(0); // non-void, Zesstra (never reached)
742}
743
744string desc(object ob)
745{
746 if (!ob)
747 return "<destructed object>";
748 if (!objectp(ob))
749 return "<corrupted stack entry>";
750 if (query_once_interactive(ob))
751 return object_name(ob)+" "+capitalize(geteuid(ob));
752 if (!hide_short && ob->short())
753 return object_name(ob)+" "+ob->name();
754 else
755 return object_name(ob);
756}
757
758string stk(string arg)
759{
760 int i,sts;
761 if (!(sts=sizeof(stack)))
762 write ("<empty stack>\n");
763 else
764 for (i=1;i<=sts;i++)
765 {
766 write("@"+(i-1)+": "+desc(stack[sts-i])+"\n");
767 }
768 return arg;
769}
770
771string clr(string arg)
772{
773 stack=({});
774 return arg;
775}
776
777string dump(string arg)
778{
779 object ob;
780 string s;
781 ob=pop();
782 if (err) return arg;
783 push(ob);
784 write("FILENAME: "+object_name(ob)+" ");
785 if (!hide_short && (s=ob->short()))
786 write(" SHORT: "+ob->name());
787 write("\n");
788 return arg;
789}
790
791string info(string arg)
792{
793 object ob;
794 mixed s;
795 int i;
796 ob=pop();
797 if (err) return arg;
798 write("FILENAME: "+object_name(ob)+" ");
799 if (s=ob->short())
800 write(" SHORT: "+ob->name());
801 write("\n");
802 if (getuid(ob))
803 write("CREATOR: "+getuid(ob)+"\n");
804 if (s=query_ip_number(ob))
805 {
806 write("IP-NUMBER: "+s+" IP-NAME: "+query_ip_name(ob)+" IDLE: "
807 + query_idle(ob)+"\n");
808 }
809 if (s=query_snoop(ob))
810 write("SNOOPED BY: "+s->query_real_name()+"\n");
811 s="";
812 if (living(ob))
813 s +="living ";
814 if (ob->query_npc())
815 s+="npc ";
816 if (ob->query_gender_string())
817 s+=ob->query_gender_string();
818 if (s!="")
819 write("FLAGS: "+s+"\n");
820 // write("LONG:\n");
821 // if (stringp(s=ob->long()))
822 // write(s);
823 // write("\n");
824 for (i=0;i<sizeof(query_list);i+=2)
825 {
826 if (query_list[i+1][0]=='-')
827 s=ob->QueryProp(query_list[i+1][1..]);
828 else
829 s=call_other(ob,query_list[i+1]);
830 if (s)
831 {
832 printf("%s: %O\n",query_list[i],s);
833 }
834 }
835 return arg;
836}
837
838string filler(int n)
839{
840 string s;
841 if (!recursive) return ": ";
842 s=": ";
843 while (++n<MAXDEPTH)
844 s=" "+s;
845 return s;
846}
847
848void listinv(object ob,int depth,string prefix)
849{
850 int i;
851 object p;
852 if (depth<MAXDEPTH)
853 {
854 p=first_inventory(ob);
855 i=1;
856 if (p)
857 {
858 while (p)
859 {
860 if (lines>lastline) return;
861 if (lines>=firstline)
862 write(prefix+"."+i+filler(depth)+desc(p)+"\n");
863 lines++;
864 if (lines==lastline+1 && next_inventory(p))
865 write("*** TRUNCATED ***\n");
866 if (recursive)
867 listinv(p,depth+1,prefix+"."+i);
868 i++;
869 p=next_inventory(p);
870 }
871 }
872 else
873 if (!depth)
874 write("<empty inventory>\n");
875 }
876}
877
878string inv(string arg)
879{
880 object ob;
881 string rest;
882 int tmp;
883 ob=pop();
884 lines=1;
885 firstline=1;
886 lastline=MAXLINES;
887 if (!err)
888 {
889 if (sscanf(arg,":%d%s",tmp,rest)==2)
890 {
891 firstline=tmp;
892 lastline=tmp+MAXLINES-1;
893 arg = rest;
894 if (sscanf(arg,":%d%s",tmp,rest)==2)
895 {
896 lastline=tmp;
897 if (lastline<firstline)
898 err = "first line > last line";
899 arg=rest;
900 }
901 }
902 push(ob);
903 listinv(ob,0,"");
904 }
905 recursive=0;
906 return arg;
907}
908
909object call_result;
910
911string call(string arg)
912{
913 string func,args;
914 int temp,i;
915 string rest,tmp;
916
917 object ob;
918 ob=pop();
919 if (err) return arg;
920 push(ob);
921 func=getarg(arg);
922 args=getrest(arg);
923 if (err) return args;
924 argv=({});
925 i=0;
926 while (1)
927 {
928 args=strip(args);
929 if (sscanf(args,"]%s",rest))
930 break;
931 if (sscanf(args,"%d%s",tmp,rest)==2)
932 {
933 args=rest;
934 argv+=({tmp});
935 continue;
936 }
937 if (sscanf(args,"\"%s\"%s",tmp,rest)==2 ||
938 sscanf(args,"\'%s\'%s",tmp,rest)==2 ||
939 sscanf(args,"|%s|%s",tmp,rest)==2)
940 {
941 args=rest;
942 argv+=({tmp});
943 continue;
944 }
945 if (sscanf(args,"@%d%s",temp,rest)==2)
946 {
947 if (temp<0 || temp>=sizeof(stack))
948 {
949 err="stackindex out of range";
950 return args;
951 }
952 argv+=({stack[sizeof(stack)-temp-1]});
953 args=rest;
954 continue;
955 }
956 tmp=getarg(args);
957 rest=getrest(args);
958 argv+=({tmp});
959 if (tmp!="")
960 {
961 args=rest;
962 continue;
963 }
964 err="bad argument to []";
965 return args;
966 }
967 if (sscanf(args,"]%s",rest)!=1)
968 {
969 err="too many or unterminated argument(s)";
970 return args;
971 }
972 call_result=apply(#'call_other,ob,func,argv);
973 //'
974 // if (objectp(call_result))
975 // write("--> "+desc(call_result)+"\n");
976 // else if (pointerp(call_result))
977 // write(array_desc(call_result));
978 // else
979 // write("--> "+call_result+"\n");
980 printf("--> %O\n",call_result);
981 pop();
982 argv=({});
983 return rest;
984}
985
986string result(string arg)
987{
988 if (objectp(call_result))
989 push(call_result);
990 else
991 err="call returned no object";
992 return arg;
993}
994
995int destroyable(object ob)
996{
997 if (!ob)
998 return 0;
999 if (query_once_interactive(ob))
1000 return 0;
1001 if (ob==this_object())
1002 return 0;
1003 return 1;
1004}
1005
1006string cln(string arg)
1007{
1008 object ob;
1009 ob=pop();
1010 if (!err)
1011 {
1012 clean(ob);
1013 write(desc(ob)+" cleaned up.\n");
1014 }
1015 recursive=0;
1016 return arg;
1017}
1018
1019string clnof(string arg)
1020{
1021 object ob;
1022 int recsave;
1023 string name,rest;
1024
1025 write("ClnOf");
1026 recsave=recursive;
1027 recursive=0;
1028 ob=pop();
1029 if (err) return arg;
1030 name=getarg(arg);
1031 rest=getrest(arg);
1032 if (err) return arg;
1033 recursive=recsave;
1034 cleanof(name,ob);
1035 recursive=0;
1036 return rest;
1037}
1038
1039void Remove(object ob,int a)
1040{
1041 if (!objectp(ob)) return;
1042 if (!a)
1043 {
1044 printf("Removing %O",ob);
1045 if (!hide_short) printf(" %O",ob->name());
1046 }
1047 catch(ob->remove());
1048 if (ob)
1049 {
1050 if (!a) printf(" HARD");
1051 destruct(ob);
1052 }
1053 write("\n");
1054}
1055
1056void clean(object ob)
1057{
1058 object p,p2;
1059 p=first_inventory(ob);
1060 while (destroyable(p))
1061 {
1062 if (recursive) clean(p);
1063 Remove(p,0);
1064 p=first_inventory(ob);
1065 }
1066 while (p)
1067 {
1068 p2=next_inventory(p);
1069 if (destroyable(p2))
1070 {
1071 if (recursive) clean(p2);
1072 Remove(p2,0);
1073 }
1074 else
1075 p=p2;
1076 }
1077}
1078
1079 void cleanof(string str,object ob)
1080{
1081 object p,p2;
1082 p=first_inventory(ob);
1083 while (p && p->id(str) && destroyable(p))
1084 {
1085 if (recursive) clean(p);
1086 Remove(p,0);
1087 p=first_inventory(ob);
1088 }
1089 while (p)
1090 {
1091 p2=next_inventory(p);
1092 if (p2 && p2->id(str) && destroyable(p2))
1093 {
1094 if (recursive) clean(p2);
1095 Remove(p2,0);
1096 }
1097 else
1098 p=p2;
1099 }
1100}
1101
1102string dest(string arg)
1103{
1104 object ob;
1105 ob=pop();
1106 if (err) return arg;
1107 if (!destroyable(ob))
1108 {
1109 err=desc(ob)+" must not be destroyed";
1110 return arg;
1111 }
1112 Remove(ob,0);
1113 return arg;
1114}
1115
1116mixed disco(string arg)
1117{
1118 object ob;
1119
1120 ob=pop();
1121 if (err) return arg;
1122 if (!interactive(ob))
1123 {
1124 err=desc(ob)+" is not interactive";
1125 return 1;
1126 }
1127 remove_interactive(ob);
1128 return arg;
1129}
1130
1131string Dest(string arg)
1132{
1133 object ob;
1134 ob=pop();
1135 if (err) return arg;
1136 if (!destroyable(ob))
1137 {
1138 err=desc(ob)+" must not be destroyed";
1139 return arg;
1140 }
1141 destruct( ob );
1142 return arg;
1143}
1144
1145string mv(string arg)
1146{
1147 object from,to;
1148 to=pop();
1149 if (err) return arg;
1150 from=pop();
1151 if (err) return arg;
1152 from->move(to,M_NOCHECK);
1153 write("Bewege "+desc(from)+" nach "+desc(to)+".\n");
1154 return arg;
1155}
1156
1157string _mv(string arg)
1158{
1159 object from,to;
1160 to=pop();
1161 if (err) return arg;
1162 from=pop();
1163 if (err) return arg;
1164 __set_environment(from,to);
1165 write("Bewege "+desc(from)+" nach "+desc(to)+".\n");
1166 return arg;
1167}
1168
1169string db_info(string arg)
1170{
1171 object ob;
1172
1173 ob=pop();
1174 if (err) return arg;
1175 debug_info(0,ob);
1176 debug_info(1,ob);
1177 return arg;
1178}
1179
1180string inheritlist(string arg)
1181{
1182 object ob;
1183 int i;
1184 string *inherited;
1185
1186 ob=pop();
1187 if (err) return arg;
1188 inherited=inherit_list(ob);
1189 write(ob);write(" inherits:\n");
1190 for (i=0;i<sizeof(inherited);i++)
1191 write(inherited[i]+"\n");
1192 return arg;
1193}
1194
1195mixed get_callout()
1196{
1197 mixed *calls,ret;
1198 string tmp;
1199 int i,j;
1200
1201 calls=call_out_info();
1202 ret=({});
1203 if (!pointerp(calls) || !sizeof(calls))
1204 return 0;
1205 for (i=0;i<sizeof(calls);i++)
1206 {
1207 if (pointerp(calls[i]))
1208 {
1209 tmp="";
1210 if (sizeof(calls[i])>3)
1211 tmp+=sprintf("%-50O %-16O",calls[i][0],calls[i][1])+sprintf(" %-6O %-3O\n",calls[i][2],calls[i][3]);
1212 else
1213 tmp+=sprintf(" *** %O\n",calls[i]);
1214 }
1215 ret+=({tmp});
1216 }
1217 return ret;
1218}
1219
1220mixed get_heartbeat()
1221{
1222 mixed *obj;
1223 string *ret;
1224 int i;
1225
1226 obj=heart_beat_info();
1227 ret=({});
1228 if (!pointerp(obj) || sizeof(obj)==0) return 0;
1229 for (i=0;i<sizeof(obj);i++)
1230 ret+=({sprintf("%O in %O\n",obj[i],environment(obj[i]))});
1231 return ret;
1232}
1233
1234string make(string arg)
1235{
1236 object *list, ob, env;
1237 string file,temp,dummy;
1238 int i,cloned;
1239
1240 ob=pop();
1241 if (err) return arg;
1242 if (!destroyable(ob))
1243 {
1244 err="can't update "+desc(ob);
1245 return arg;
1246 }
1247 env=environment(ob);
1248 file=object_name(ob);
1249 write("Updating "+object_name(ob)+"...\n");
1250 if (sscanf(file,"%s#%s",temp,dummy)==2)
1251 {
1252 file=temp;
1253 cloned=1;
1254 }
1255 else
1256 cloned=0;
1257 list=all_inventory(ob);
1258 for (i=sizeof(list)-1;i>=0;i--)
1259 if (list[i] && query_once_interactive(list[i]))
1260 {
1261 list[i]->move("room/void",M_TPORT | M_SILENT | M_NO_SHOW | M_NOCHECK);
1262 } else
1263 list[i]=0;
1264 list-=({0});
1265
1266 if (ob)
1267 {
1268 Remove(ob,1);
1269 }
1270 if (cloned)
1271 {
1272 if (ob=find_object(file))
1273 {
1274 Remove(ob,1);
1275 }
1276 err=catch(ob=clone_object(file));
1277 if (!err)
1278 ob->move(env,M_TPORT | M_SILENT | M_NO_SHOW | M_NOCHECK);
1279 }
1280 else
1281 {
1282 err=catch(call_other(file,"???"));
1283 if (!err)
1284 ob=find_object(file);
1285 else
1286 ob=0;
1287 }
1288 if (!ob)
1289 {
1290 write("Error in loaded object. Staying in void ...\n");
1291 return arg;
1292 }
1293 for (i=sizeof(list)-1;i>=0;i--)
1294 if (list[i])
1295 list[i]->move(ob,M_TPORT | M_SILENT | M_NO_SHOW | M_NOCHECK);
1296 return arg;
1297}
1298
1299string rec(string arg)
1300{
1301 recursive=1;
1302 return arg;
1303}
1304
1305string norec(string arg)
1306{
1307 recursive=0;
1308 return arg;
1309}
1310
1311string readvar(string arg)
1312{
1313 string rest;
1314 int no;
1315 if (sscanf(arg,"%d%s",no,rest)!=2 || no<0 || no>=MAXVARS)
1316 {
1317 err="illegal var number";
1318 return arg;
1319 }
1320 if (vararea[no])
1321 push(vararea[no]);
1322 else
1323 err="var #"+no+" is empty";
1324 return rest;
1325}
1326
1327string writevar(string arg)
1328{
1329 string rest;
1330 int no;
1331 object ob;
1332 if (sscanf(arg,"%d%s",no,rest)!=2 || no<0 || no>=MAXVARS)
1333 {
1334 err="illegal var number";
1335 return arg;
1336 }
1337 ob=pop();
1338 if (err) return rest;
1339 vararea[no]=ob;
1340 return rest;
1341}
1342
1343string vars(string arg)
1344{
1345 int i;
1346 for (i=0;i<MAXVARS;i++)
1347 {
1348 if (vararea[i])
1349 write("<"+i+": "+desc(vararea[i])+"\n");
1350 }
1351 return arg;
1352}
1353
1354void vanish()
1355{
1356 // RemoveAutoload();
1357 destruct( this_object() );
1358}
1359
1360mixed rusage(string arg)
1361{
1362 mixed *resusage;
1363 int i,j;
1364/*
1365 resusage=({mixed *})efun::rusage();
1366 for (i=0;i<18;i++){
1367 write(align(({"User time","System time","Max res set size",
1368 "Page reclaims","Page faults",
1369 "Unshared stack size",
1370 "Shared text size","Unshared data size",
1371 "System swaps",
1372 "Block input operations","Block output operations",
1373 "Messages sent","Messages received","Signals received",
1374 "Voluntary context switches","Involuntary context switches",
1375 "Total internet packets","Total internet bytes"})[i],
1376 40)+": "+resusage[i]+"\n");
1377 }
1378 return arg;
1379 */
1380 return ({});
1381}
1382
1383string align(string s,int x){
1384 return (s+" ")[0..x-1];
1385}
1386
1387static string swho(string arg)
1388{
1389 object *userlist, snooper, found;mixed active;
1390 int i,j,done;
1391
1392 if (geteuid(this_interactive())!=geteuid()) return arg;
1393 userlist=users();
1394 active=({});
1395 for (i=sizeof(userlist)-1;i>=0;i--)
1396 if (snooper=query_snoop(userlist[i]))
1397 {
1398 if (member(active,snooper)==-1)
1399 active+=({snooper});
1400 if (member(active,userlist[i])==-1)
1401 active+=({userlist[i]});
1402 }
1403 if (!sizeof(active))
1404 {
1405 printf("Keine aktiven Snoops.\n");
1406 return arg;
1407 }
1408 for (i=sizeof(active)-1;i>=0;i--)
1409 active[i]=({active[i]});
1410 for (i=sizeof(active)-1;i>=0;i--)
1411 if (pointerp(active[i])&&snooper=query_snoop(active[i][0]))
1412 {
1413 done=0;
1414 for (j=sizeof(active)-1;j>=0 && !done;j--)
1415 if (pointerp(active[j]) && active[j][sizeof(active[j])-1]==snooper)
1416 {
1417 active[j]+=active[i];
1418 active[i]=0;
1419 done=1;
1420 }
1421 }
1422 active-=({0});
1423 for (i=0;i<sizeof(active);i++)
1424 {
1425 for (j=0;j<sizeof(active[i]);j++)
1426 printf("%s%s",(j==0?"":" -> "),capitalize(getuid(active[i][j])));
1427 printf("\n");
1428 }
1429 return arg;
1430}
1431
1432string timef(int sec)
1433{
1434 string s;
1435
1436 s="";
1437 if (sec>=86400)
1438 s+=sprintf("%d d, ",sec/86400);
1439 if (sec>3600)
1440 s+=sprintf("%d h, ",(sec/3600)%24);
1441 if (sec>60)
1442 s+=sprintf("%d m, ",(sec/60)%60);
1443 return s+sprintf("%d s",sec%60);
1444}
1445
1446string idle(string arg)
1447{
1448 object ob;
1449 int i;
1450
1451 ob=pop();
1452 if (err) return arg;
1453 write(capitalize(ob->name(WER))+" ");
1454 if (!query_once_interactive(ob))
1455 {
1456 write("ist kein echter Spieler.\n");
1457 return arg;
1458 }
1459 if (!query_ip_number(ob))
1460 {
1461 write("ist netztot.\n");
1462 return arg;
1463 }
1464 printf("ist idle seit %d Sekunden",i=query_idle(ob));
1465 if (i>60)
1466 printf(" (%s)\n",timef(i));
1467 else
1468 write("\n");
1469 return arg;
1470}
1471
1472string stat(string arg)
1473{
1474 object ob;
1475 mapping quests;
1476 mixed stats, *arr, tmp,tmp2, list;
1477 string titel, level, stat_str,weapon,armour;
1478 int pl;
1479 int i;
1480
1481 ob=pop();
1482 if (err)
1483 return arg;
1484
1485 titel=ob->QueryProp(P_TITLE);
1486 if (!(pl=query_once_interactive(ob)))
1487 level="Monster="+old_explode(object_name(ob),"#")[0];
1488 else
1489 if (IS_GOD(ob))
1490 level="Mud-Gott";
1491 else if (IS_ARCH(ob))
1492 level="Erzmagier";
1493 else if (IS_ELDER(ob))
1494 level="Weiser";
1495 else if (IS_LORD(ob))
1496 level="Regionsmagier";
1497 else if (IS_DOMAINMEMBER(ob))
1498 level="Regionsmitglied";
1499 else if (IS_WIZARD(ob))
1500 level="Magier";
1501 else if (IS_LEARNER(ob))
1502 level="Lehrling";
1503 else if (IS_SEER(ob))
1504 level="Seher";
1505 else level="Spieler";
1506 if (IS_DOMAINMEMBER(ob))
1507 for (tmp="secure/master"->get_domain_homes(geteuid(ob));
1508 sizeof(tmp);tmp=tmp[1..])
1509 level+="-"+capitalize(tmp[0]);
1510 if (pl)
1511 {
1512 if (!interactive(ob))
1513 level+=", netztot";
1514 else
1515 if (query_idle(ob)>600)
1516 level+=", idle";
1517 if (ob->QueryProp(P_GHOST))
1518 level+=", tot";
1519 if (ob->QueryProp(P_INVIS))
1520 level+=", unsichtbar";
1521 if (ob->QueryProp(P_FROG))
1522 level+=", gruen und glitschig";
1523 if (ob->QueryProp(P_TESTPLAYER))
1524 level+=", Testspieler";
1525 }
1526 tmp=ob->QueryProp(P_PRESAY);
1527 if (tmp && tmp!="")
1528 tmp=tmp+" ";
1529 else
1530 tmp="";
1531 tmp2=ob->QueryProp(P_RACE);
1532 if(!tmp2)
1533 tmp2="Dingsda";
1534 arr=ob->QueryProp(P_NAME);
1535 if (pointerp(arr)) arr=arr[0];
1536 printf("%s%s %s (%s)[%s].\n\n",tmp||"",arr||"",titel||"",
1537 tmp2||"??",level||"??");
1538 if (pl)
1539 printf(" Alter : %s.%s\n",
1540 timef(2*ob->QueryProp(P_AGE)),
1541 (tmp=ob->QueryProp(P_MARRIED))?
1542 ("Verheiratet mit "+capitalize(tmp)+"."):"");
1543 else
1544 printf(" Aggressiv : %4s Gespraechig : %d%%\n",
1545 ob->QueryProp(P_AGGRESSIVE)? "Ja" : "Nein",
1546 ob->QueryProp(P_CHAT_CHANCE)) ;
1547 printf(" Lebenspunkte : [%4d/%4d] Magiepunkte : [%4d/%4d] " +
1548 "Erfahrung : %d\n",
1549 ob->QueryProp(P_HP), ob->QueryProp(P_MAX_HP),
1550 ob->QueryProp(P_SP), ob->QueryProp(P_MAX_SP),
1551 ob->QueryProp(P_XP));
1552 printf(" Nahrung : [%3d/%d] Fluessigkeit : [%3d/%d] " +
1553 "Alkohol : [%3d/%d]\n",
1554 ob->QueryProp(P_FOOD), ob->QueryProp(P_MAX_FOOD),
1555 ob->QueryProp(P_DRINK), ob->QueryProp(P_MAX_DRINK),
1556 ob->QueryProp(P_ALCOHOL), ob->QueryProp(P_MAX_ALCOHOL)) ;
1557 switch(ob->QueryProp(P_GENDER)) {
1558 case FEMALE : tmp2 = "weiblich " ; break ;
1559 case MALE : tmp2 = "maennlich" ; break ;
1560 default : tmp2 = "boingisch" ; break ;
1561 }
1562 printf(" Geschlecht : %s Charakter : %-5d Stufe : %-3d\n",
1563 tmp2, ob->QueryProp(P_ALIGN), ob->QueryProp(P_LEVEL)) ;
1564 stats = ob->QueryProp(P_ATTRIBUTES) ;
1565 if (!mappingp(stats)) stats=([]);
1566 tmp = m_indices(stats); tmp2 = m_values(stats); stat_str = "" ;
1567 for(; sizeof(tmp); tmp=tmp[1..],tmp2=tmp2[1..])
1568 stat_str += (tmp[ 0 ] + "[" + tmp2[ 0 ] + "] ") ;
1569
1570 if(stat_str == "")
1571 stat_str = "Keine" ;
1572 else
1573 stat_str = stat_str[0..<2];
1574
1575 printf(" Geld : %-9d Stati : %s\n\n", ob->QueryMoney(),
1576 stat_str) ;
1577
1578 weapon = "Keine" ; armour = "" ;
1579 for(tmp=all_inventory(ob); sizeof(tmp); tmp=tmp[1..])
1580 {
1581 if(tmp[ 0 ]->QueryProp(P_WIELDED)) // gezueckte Waffe
1582 weapon = (tmp[ 0 ]->name(WER)) + " (" +
1583 old_explode(object_name(tmp[ 0 ]),"#")[0] + ")[" +
1584 tmp[ 0 ]->QueryProp(P_WC) + "]" ;
1585
1586 if(tmp[ 0 ]->QueryProp(P_WORN)) // getragene Ruestung
1587 armour += (tmp[ 0 ]->name(WER)) + "[" +
1588 tmp[ 0 ]->QueryProp(P_AC) + "]" +
1589 ", " ;
1590 }
1591
1592 if(armour == "")
1593 armour = "Keine" ;
1594 else
1595 {
1596 tmp = old_explode(break_string(armour[0..sizeof(armour) - 3],
1597 63), "\n") ;
1598 armour = tmp[ 0 ] ;
1599 tmp=tmp[1..];
1600 for (;sizeof(tmp); tmp=tmp[1..])
1601 armour += "\n " + tmp[ 0 ] ;
1602 }
1603
1604 printf(" Waffe(%3d) : %s\nRuestung(%3d) : %s\n",
1605 ob->QueryProp(P_TOTAL_WC), weapon,
1606 ob->QueryProp(P_TOTAL_AC), armour) ;
1607
1608 list = ob->QueryEnemies();
1609 if (pointerp(list))
1610 {
1611 list=list[0];
1612 tmp2 = "" ;
1613 for(i=sizeof(list)-1 ; i>=0;i--)
1614 if (objectp(list[i]))
1615 tmp2 += (list[ i ]->name(WER) + ", ") ;
1616 if(tmp2 != "")
1617 printf(" Feinde : %s.\n", tmp2[0..<3]);
1618 }
1619
1620 // 8.Zeile : Geloeste Aufgaben
1621 if(pl)
1622 {
1623 printf( break_string(
1624 CountUp(m_indices(ob->QueryProp(P_QUESTS))),
1625 75,
1626 " Aufgaben : ",
1627 BS_INDENT_ONCE));
1628 if(((tmp2 = ob->QueryProp(P_MAILADDR)) != "none") && tmp2 &&
1629 (tmp2 != ""))
1630 tmp2 = " (" + tmp2 + ")" ;
1631 else
1632 tmp2 = "" ;
1633 }
1634 else
1635 tmp2 = "" ;
1636
1637 if(environment(ob))
1638 printf(" Aufenthalt : %s%s.\n",
1639 old_explode(object_name(environment(ob)),"#")[0], tmp2) ;
1640
1641 return arg;
1642}
1643
1644string scan(string arg)
1645{
1646 object ob;
1647 mixed tmp,tmp2,tmp3;
1648 int i;
1649
1650 ob=pop();
1651 if (err) return arg;
1652 if (query_once_interactive(ob))
1653 printf("Spieler: %s, Level: %d, Wizlevel: %d\n",
1654 capitalize(getuid(ob)), ob->QueryProp(P_LEVEL),
1655 query_wiz_level(ob));
1656 else
1657 printf("Monster, UID: %s, EUID: %s, Level: %d\n",
1658 getuid(ob), (geteuid(ob)?geteuid(ob):"0"), ob->QueryProp(P_LEVEL));
1659 tmp=ob->short();
1660 if (!stringp(tmp)||!sizeof(tmp))
1661 tmp=sprintf("(%s %s %s %s)",ob->QueryProp(P_PRESAY)+"",
1662 ob->QueryProp(P_NAME)+"",ob->QueryProp(P_TITLE)+"",
1663 (interactive(ob)?"":"(netztot"));
1664 else
1665 tmp=tmp[0..<3];
1666 printf("%s, Rasse: %s\n",tmp, ""+ob->QueryProp(P_RACE));
1667 printf("Stats: ");
1668 tmp=ob->QueryProp(P_ATTRIBUTES);
1669 tmp3=ob->QueryProp(P_ATTRIBUTES_OFFSETS);
1670 if (!tmp)
1671 printf("keine\n");
1672 else
1673 {
1674 tmp2=m_indices(tmp);
1675 for (i=0;i<sizeof(tmp2);i++)
1676 {
1677 printf("%s%s: %d",(i>0?", ":""),tmp2[i],tmp[tmp2[i]]);
1678 if (tmp3[tmp2[i]])
1679 printf("%+d",tmp3[tmp2[i]]);
1680 }
1681 printf("\n");
1682 }
1683 printf("Ruestung: %-6d Waffen: %-6d Vorsicht: %-6d Geschlecht: ",
1684 ob->QueryProp(P_TOTAL_AC),ob->QueryProp(P_TOTAL_WC),
1685 ob->QueryProp(P_WIMPY));
1686 if (!(tmp=ob->QueryProp(P_GENDER)))
1687 printf("N\n");
1688 else
1689 {
1690 if (tmp==2)
1691 printf("F\n");
1692 else
1693 printf("M\n");
1694 }
1695 if (tmp=ob->QueryProp(P_MARRIED))
1696 printf("Verheiratet mit %s.\n",capitalize(tmp));
1697 printf("Lebenspunkte: %4d [%4d], Magiepunkte: %4d [%4d], Erf: %-8d\n",
1698 ob->QueryProp(P_HP), ob->QueryProp(P_MAX_HP),
1699 ob->QueryProp(P_SP), ob->QueryProp(P_MAX_SP),
1700 ob->QueryProp(P_XP));
1701 if (living(ob))
1702 {
1703 tmp=present("geld",ob);
1704 if (tmp)
1705 tmp=tmp->QueryProp(P_AMOUNT);
1706 printf("Traegt %6d (%6d) g. Eigengewicht %6d g. %6d Muenzen.\n",
1707 ob->query_weight_contents(),ob->QueryProp(P_MAX_WEIGHT),
1708 ob->QueryProp(P_WEIGHT),tmp);
1709 if (tmp=ob->SelectEnemy())
1710 printf("Kaempft gegen %s [%O]\n",tmp->name(WEN),tmp);
1711 }
1712 printf("ENV: %s",
1713 ((tmp=environment(ob))?object_name(tmp):"- fabric of space -"));
1714 if(query_once_interactive(ob))
1715 {
1716 printf(", EMail: %s\n", ob->QueryProp(P_MAILADDR)+"");
1717 tmp="/secure/master"->find_userinfo(getuid(ob));
1718 if (pointerp(tmp) && sizeof(tmp)>USER_DOMAIN)
1719 {
1720 tmp=tmp[USER_DOMAIN];
1721 if (pointerp(tmp) && sizeof(tmp))
1722 {
1723 printf("Lord in: ");
1724 for (tmp2=0;tmp2<sizeof(tmp);tmp2++)
1725 printf("%s%s",(tmp2>0?", ":""),""+tmp[tmp2]);
1726 printf(".\n");
1727 }
1728 }
1729 tmp="/secure/master"->get_domain_homes(getuid(ob));
1730 if (pointerp(tmp)&&sizeof(tmp)>0)
1731 {
1732 printf("Mitglied in: ");
1733 for (tmp2=0;tmp2<sizeof(tmp);tmp2++)
1734 printf("%s%s",(tmp2>0?", ":""),""+tmp[tmp2]);
1735 printf(".\n");
1736 }
1737 printf("Quests: ");
1738 tmp=ob->QueryProp(P_QUESTS);
1739 if (tmp==({})||!pointerp(tmp))
1740 printf("Keine.\n");
1741 else
1742 {
1743 tmp2="";
1744 tmp-=({({}),0});
1745 for (i=0; i<sizeof(tmp); i++)
1746 tmp2+=sprintf("%s%s",(i?", ":""),tmp[i][0]);
1747 tmp=break_string(tmp2,79,8);
1748 tmp=tmp[8..];
1749 printf("%s",tmp);
1750 }
1751 printf("PKills: %d ",ob->QueryProp(P_KILLS));
1752 printf(", QuestPoints: %d (%d/%d), Alter: %s\n",ob->QueryProp(P_QP),ob->QueryProp(P_NEEDED_QP),QM->QueryMaxQP(),timef(2*ob->QueryProp(P_AGE)));
1753 if (interactive(ob))
1754 {
1755 printf("From: %s (%s) [%s]\n",query_ip_name(ob),query_ip_number(ob),country(query_ip_name(ob)));
1756 tmp=query_idle(ob);
1757 printf("Idle seit %d Sekunden",tmp);
1758 if (tmp>60)
1759 printf(" (%s)",timef(tmp));
1760 printf(", cmd avg: %d",ob->QueryProp("command_average"));
1761 printf(", noch %d ZT zu finden.\nGesnooped von: %s\n",
1762 ((tmp=ob->QueryProp(P_POTIONROOMS))?sizeof(tmp):0),
1763 ((tmp=query_snoop(ob))?capitalize(getuid(tmp)):"Niemandem"));
1764 }
1765 else
1766 {
1767 tmp=getuid(ob);
1768 tmp=file_time("save/"+tmp[0..0]+"/"+tmp+".o");
1769 tmp=time()-tmp;
1770 printf("Kam von: %s, vor: %d s(%s)\n",
1771 ob->QueryProp(P_CALLED_FROM_IP),tmp,timef(tmp));
1772 }
1773 }
1774 else
1775 printf("\n");
1776 return arg;
1777}
1778
1779mixed dinfo(string arg)
1780{
1781 object ob;
1782
1783 ob=pop();
1784 if (!ob)
1785 return 1;
1786 debug_info(0,ob);
1787 return arg;
1788}
1789
1790mixed minfo(string arg)
1791{
1792 object ob;
1793
1794 ob=pop();
1795 if (!ob)
1796 return 1;
1797 debug_info(1,ob);
1798 return arg;
1799}
1800
1801void dump_list(mixed what)
1802{
1803 int i,s;
1804
1805 if (!pointerp(what)||!(s=sizeof(what)))
1806 return;
1807 for (i=0;i<s;i++)
1808 write(what[i]);
1809}
1810
1811string callout(string args)
1812{
1813 dump_list(get_callout());
1814 return args;
1815}
1816
1817string heartbeat(string args)
1818{
1819 dump_list(get_heartbeat());
1820 return args;
1821}
1822
1823string dumplists(string args)
1824{
1825 string filen;
1826 string *list;
1827 int i,s;
1828
1829 if (!geteuid(this_object()))
1830 return args;
1831 filen="/players/"+geteuid(this_object())+"/LISTS.LUPE";
1832 write("Dumping to "+filen+" ... ");
1833 if (file_size(filen)>=0)
1834 rm(filen);
1835 write_file(filen,"OBJECT WITH ACTIVE HEART_BEAT:\n");
1836 list=get_heartbeat();
1837 if (!list || !(s=sizeof(list)))
1838 write_file(filen,"NONE\n");
1839 for (i=0;i<s;i++)
1840 write_file(filen,list[i]);
1841 write_file(filen,"\n\nRUNNING CALL_OUTS:\n");
1842 list=get_callout();
1843 if (!list || !(s=sizeof(list)))
1844 write_file(filen,"NONE\n");
1845 for (i=0;i<s;i++)
1846 write_file(filen,list[i]);
1847 write("done.\n");
1848 return args;
1849}
1850
1851mixed renew_player(string arg)
1852{
1853 object ob;
1854
1855 ob=pop();
1856 if (!ob)
1857 return 1;
1858 if (!objectp(ob)&&!interactive(ob))
1859 {
1860 err=desc(ob)+" is not an interactive player";
1861 return arg;
1862 }
1863 if ((err="/secure/master"->renew_player_object(ob))<0)
1864 err="error "+err+" when renewing "+desc(ob);
1865 return arg;
1866}
1867
1868mixed copy_ldfied(string arg)
1869{
1870 object ob, new;
1871 mapping props;
1872
1873 ob=pop();
1874 if (!ob)
1875 return 1;
1876 if (!objectp(ob))
1877 {
1878 err=desc(ob)+" is not an valid object";
1879 return arg;
1880 }
1881 new=clone_object(old_explode(object_name(ob),"#")[0]);
1882 props=ob->QueryProperties();
1883 new->SetProperties(ob->QueryProperties());
1884 push(new);
1885 new->move(this_player(),M_NOCHECK);
1886 return arg;
1887}
1888