ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_misc.C
(Generate patch)

Comparing deliantra/server/server/c_misc.C (file contents):
Revision 1.47 by pippijn, Thu Mar 1 13:27:52 2007 UTC vs.
Revision 1.52 by pippijn, Fri Mar 2 11:07:59 2007 UTC

333 { 333 {
334 sprintf (buf, "Global debug level is %d.", settings.debug); 334 sprintf (buf, "Global debug level is %d.", settings.debug);
335 new_draw_info (NDI_UNIQUE, 0, op, buf); 335 new_draw_info (NDI_UNIQUE, 0, op, buf);
336 return 1; 336 return 1;
337 } 337 }
338 if (op != NULL && !QUERY_FLAG (op, FLAG_WIZ))
339 {
340 new_draw_info (NDI_UNIQUE, 0, op, "Privileged command.");
341 return 1;
342 }
343 settings.debug = (enum LogLevel) FABS (i); 338 settings.debug = (enum LogLevel) FABS (i);
344 sprintf (buf, "Set debug level to %d.", i); 339 sprintf (buf, "Set debug level to %d.", i);
345 new_draw_info (NDI_UNIQUE, 0, op, buf); 340 new_draw_info (NDI_UNIQUE, 0, op, buf);
346 return 1; 341 return 1;
347} 342}
403 } 398 }
404 else 399 else
405 { 400 {
406 LOG (llevError, "Cannot write bugs file %s: %s\n", BUG_LOG, strerror (errno)); 401 LOG (llevError, "Cannot write bugs file %s: %s\n", BUG_LOG, strerror (errno));
407 } 402 }
408}
409
410int
411command_output_sync (object *op, char *params)
412{
413 int val;
414
415 if (!params)
416 {
417 new_draw_info_format (NDI_UNIQUE, 0, op, "Output sync time is presently %d", op->contr->outputs_sync);
418 return 1;
419 }
420 val = atoi (params);
421 if (val > 0)
422 {
423 op->contr->outputs_sync = val;
424 new_draw_info_format (NDI_UNIQUE, 0, op, "Output sync time now set to %d", op->contr->outputs_sync);
425 }
426 else
427 new_draw_info (NDI_UNIQUE, 0, op, "Invalid value for output_sync.");
428
429 return 1;
430}
431
432int
433command_output_count (object *op, char *params)
434{
435 int val;
436
437 if (!params)
438 {
439 new_draw_info_format (NDI_UNIQUE, 0, op, "Output count is presently %d", op->contr->outputs_count);
440 return 1;
441 }
442 val = atoi (params);
443 if (val > 0)
444 {
445 op->contr->outputs_count = val;
446 new_draw_info_format (NDI_UNIQUE, 0, op, "Output count now set to %d", op->contr->outputs_count);
447 }
448 else
449 new_draw_info (NDI_UNIQUE, 0, op, "Invalid value for output_count.");
450
451 return 1;
452}
453
454int
455command_listen (object *op, char *params)
456{
457 int i;
458
459 if (params == NULL || !sscanf (params, "%d", &i))
460 {
461 new_draw_info_format (NDI_UNIQUE, 0, op, "Set listen to what (presently %d)?", op->contr->listening);
462 return 1;
463 }
464 op->contr->listening = (char) i;
465 new_draw_info_format (NDI_UNIQUE, 0, op, "Your verbose level is now %d.", i);
466 return 1;
467} 403}
468 404
469/* Prints out some useful information for the character. Everything we print 405/* Prints out some useful information for the character. Everything we print
470 * out can be determined by the docs, so we aren't revealing anything extra - 406 * out can be determined by the docs, so we aren't revealing anything extra -
471 * rather, we are making it convenient to find the values. params have 407 * rather, we are making it convenient to find the values. params have
503int 439int
504command_fix_me (object *op, char *params) 440command_fix_me (object *op, char *params)
505{ 441{
506 sum_weight (op); 442 sum_weight (op);
507 op->update_stats (); 443 op->update_stats ();
444 new_draw_info (NDI_UNIQUE, 0, op, "Your character was fixed.");
445
508 return 1; 446 return 1;
509} 447}
510 448
511int 449int
512command_logs (object *op, char *params) 450command_logs (object *op, char *params)
513{ 451{
514 new_draw_info (NDI_UNIQUE, 0, op, "Nobody is currently logging kills."); 452 new_draw_info (NDI_UNIQUE, 0, op, "Nobody is currently logging kills.");
515 453
516 return 1;
517}
518
519int
520command_applymode (object *op, char *params)
521{
522 unapplymode unapply = op->contr->unapply;
523 static const char *const types[] = { "nochoice", "never", "always" };
524
525 if (!params)
526 {
527 new_draw_info_format (NDI_UNIQUE, 0, op, "applymode is set to %s", types[op->contr->unapply]);
528 return 1;
529 }
530
531 if (!strcmp (params, "nochoice"))
532 op->contr->unapply = unapply_nochoice;
533 else if (!strcmp (params, "never"))
534 op->contr->unapply = unapply_never;
535 else if (!strcmp (params, "always"))
536 op->contr->unapply = unapply_always;
537 else
538 {
539 new_draw_info_format (NDI_UNIQUE, 0, op, "applymode: Unknown options %s, valid options are nochoice, never, always", params);
540 return 0;
541 }
542
543 new_draw_info_format (NDI_UNIQUE, 0, op, "Applymode %s set to %s",
544 (unapply == op->contr->unapply ? "" : " now"), types[op->contr->unapply]);
545 return 1; 454 return 1;
546} 455}
547 456
548int 457int
549command_bowmode (object *op, char *params) 458command_bowmode (object *op, char *params)
587 new_draw_info_format (NDI_UNIQUE, 0, op, buf); 496 new_draw_info_format (NDI_UNIQUE, 0, op, buf);
588 return 0; 497 return 0;
589 } 498 }
590 499
591 new_draw_info_format (NDI_UNIQUE, 0, op, "bowmode %s set to %s", (oldtype == op->contr->bowtype ? "" : "now"), types[op->contr->bowtype]); 500 new_draw_info_format (NDI_UNIQUE, 0, op, "bowmode %s set to %s", (oldtype == op->contr->bowtype ? "" : "now"), types[op->contr->bowtype]);
592 return 1;
593}
594
595int
596command_petmode (object *op, char *params)
597{
598 petmode_t oldtype = op->contr->petmode;
599 static const char *const types[] = { "normal", "sad", "defend", "arena" };
600
601 if (!params)
602 {
603 new_draw_info_format (NDI_UNIQUE, 0, op, "petmode is set to %s", types[op->contr->petmode]);
604 return 1;
605 }
606
607 if (!strcmp (params, "normal"))
608 op->contr->petmode = pet_normal;
609 else if (!strcmp (params, "sad"))
610 op->contr->petmode = pet_sad;
611 else if (!strcmp (params, "defend"))
612 op->contr->petmode = pet_defend;
613 else if (!strcmp (params, "arena"))
614 op->contr->petmode = pet_arena;
615 else
616 {
617 new_draw_info_format (NDI_UNIQUE, 0, op,
618 "petmode: Unknown options %s, valid options are normal," "sad (seek and destroy), defend, arena", params);
619 return 0;
620 }
621 new_draw_info_format (NDI_UNIQUE, 0, op, "petmode %s set to %s", (oldtype == op->contr->petmode ? "" : "now"), types[op->contr->petmode]);
622 return 1; 501 return 1;
623} 502}
624 503
625int 504int
626command_showpets (object *op, char *params) 505command_showpets (object *op, char *params)
667 new_draw_info (NDI_UNIQUE, 0, op, "no such pet."); 546 new_draw_info (NDI_UNIQUE, 0, op, "no such pet.");
668 return 0; 547 return 0;
669} 548}
670 549
671int 550int
672command_usekeys (object *op, char *params)
673{
674 usekeytype oldtype = op->contr->usekeys;
675 static const char *const types[] = { "inventory", "keyrings", "containers" };
676
677 if (!params)
678 {
679 new_draw_info_format (NDI_UNIQUE, 0, op, "usekeys is set to %s", types[op->contr->usekeys]);
680 return 1;
681 }
682
683 if (!strcmp (params, "inventory"))
684 op->contr->usekeys = key_inventory;
685 else if (!strcmp (params, "keyrings"))
686 op->contr->usekeys = keyrings;
687 else if (!strcmp (params, "containers"))
688 op->contr->usekeys = containers;
689 else
690 {
691 new_draw_info_format (NDI_UNIQUE, 0, op, "usekeys: Unknown options %s, valid options are inventory, keyrings, containers", params);
692 return 0;
693 }
694 new_draw_info_format (NDI_UNIQUE, 0, op, "usekeys %s set to %s", (oldtype == op->contr->usekeys ? "" : "now"), types[op->contr->usekeys]);
695 return 1;
696}
697
698int
699command_resistances (object *op, char *params) 551command_resistances (object *op, char *params)
700{ 552{
701 int i; 553 int i;
702 554
703 if (!op) 555 if (!op)
986 return 0; 838 return 0;
987 } 839 }
988} 840}
989 841
990int 842int
991command_sound (object *op, char *params)
992{
993 if (op->contr->ns->sound)
994 {
995 op->contr->ns->sound = 0;
996 new_draw_info (NDI_UNIQUE, 0, op, "Silence is golden...");
997 }
998 else
999 {
1000 op->contr->ns->sound = 1;
1001 new_draw_info (NDI_UNIQUE, 0, op, "The sounds are enabled.");
1002 }
1003
1004 return 1;
1005}
1006
1007int
1008command_title (object *op, char *params) 843command_title (object *op, char *params)
1009{ 844{
1010 char buf[MAX_BUF]; 845 char buf[MAX_BUF];
1011 846
1012 if (settings.set_title == FALSE) 847 if (settings.set_title == FALSE)
1046 new_draw_info (NDI_UNIQUE, 0, op, "Title too long."); 881 new_draw_info (NDI_UNIQUE, 0, op, "Title too long.");
1047 return 1; 882 return 1;
1048 } 883 }
1049 strcpy (op->contr->own_title, params); 884 strcpy (op->contr->own_title, params);
1050 return 1; 885 return 1;
1051}
1052
1053int
1054command_peaceful (object *op, char *params)
1055{
1056 new_draw_info (NDI_UNIQUE, 0, op,
1057 "You cannot change your peaceful setting with this command."
1058 " Please speak to the priest in the temple of Gorokh"
1059 " if you want to become hostile or in temple of Valriel" " if you want to become peaceful again.");
1060
1061/*
1062 if((op->contr->peaceful=!op->contr->peaceful))
1063 new_draw_info(NDI_UNIQUE, 0,op,"You will not attack other players.");
1064 else
1065 new_draw_info(NDI_UNIQUE, 0,op,"You will attack other players.");
1066*/
1067 return 1;
1068}
1069
1070int
1071command_wimpy (object *op, char *params)
1072{
1073 int i;
1074 char buf[MAX_BUF];
1075
1076 if (params == NULL || !sscanf (params, "%d", &i))
1077 {
1078 sprintf (buf, "Your current wimpy level is %d.", op->run_away);
1079 new_draw_info (NDI_UNIQUE, 0, op, buf);
1080 return 1;
1081 }
1082 sprintf (buf, "Your new wimpy level is %d.", i);
1083 new_draw_info (NDI_UNIQUE, 0, op, buf);
1084 op->run_away = i;
1085 return 1;
1086}
1087
1088int
1089command_brace (object *op, char *params)
1090{
1091 if (!params)
1092 op->contr->braced = !op->contr->braced;
1093 else
1094 op->contr->braced = onoff_value (params);
1095
1096 if (op->contr->braced)
1097 new_draw_info (NDI_UNIQUE, 0, op, "You are braced.");
1098 else
1099 new_draw_info (NDI_UNIQUE, 0, op, "Not braced.");
1100
1101 op->update_stats ();
1102 return 0;
1103} 886}
1104 887
1105int 888int
1106command_kill_pets (object *op, char *params) 889command_kill_pets (object *op, char *params)
1107{ 890{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines