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