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.46 by pippijn, Thu Mar 1 13:18:37 2007 UTC vs.
Revision 1.51 by pippijn, Fri Mar 2 10:55:00 2007 UTC

161 char namebuf[MAX_BUF]; 161 char namebuf[MAX_BUF];
162 int login_order; 162 int login_order;
163} chars_names; 163} chars_names;
164 164
165int 165int
166command_afk (object *op, char *params)
167{
168 if ((op->contr->ns->afk = !op->contr->ns->afk))
169 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer AFK");
170 else
171 new_draw_info (NDI_UNIQUE, 0, op, "You are now AFK");
172
173 return 1;
174}
175
176int
177command_mapinfo (object *op, char *params) 166command_mapinfo (object *op, char *params)
178{ 167{
179 current_map_info (op); 168 current_map_info (op);
180 return 1; 169 return 1;
181} 170}
344 { 333 {
345 sprintf (buf, "Global debug level is %d.", settings.debug); 334 sprintf (buf, "Global debug level is %d.", settings.debug);
346 new_draw_info (NDI_UNIQUE, 0, op, buf); 335 new_draw_info (NDI_UNIQUE, 0, op, buf);
347 return 1; 336 return 1;
348 } 337 }
349 if (op != NULL && !QUERY_FLAG (op, FLAG_WIZ))
350 {
351 new_draw_info (NDI_UNIQUE, 0, op, "Privileged command.");
352 return 1;
353 }
354 settings.debug = (enum LogLevel) FABS (i); 338 settings.debug = (enum LogLevel) FABS (i);
355 sprintf (buf, "Set debug level to %d.", i); 339 sprintf (buf, "Set debug level to %d.", i);
356 new_draw_info (NDI_UNIQUE, 0, op, buf); 340 new_draw_info (NDI_UNIQUE, 0, op, buf);
357 return 1; 341 return 1;
358} 342}
457 new_draw_info_format (NDI_UNIQUE, 0, op, "Output count now set to %d", op->contr->outputs_count); 441 new_draw_info_format (NDI_UNIQUE, 0, op, "Output count now set to %d", op->contr->outputs_count);
458 } 442 }
459 else 443 else
460 new_draw_info (NDI_UNIQUE, 0, op, "Invalid value for output_count."); 444 new_draw_info (NDI_UNIQUE, 0, op, "Invalid value for output_count.");
461 445
462 return 1;
463}
464
465int
466command_listen (object *op, char *params)
467{
468 int i;
469
470 if (params == NULL || !sscanf (params, "%d", &i))
471 {
472 new_draw_info_format (NDI_UNIQUE, 0, op, "Set listen to what (presently %d)?", op->contr->listening);
473 return 1;
474 }
475 op->contr->listening = (char) i;
476 new_draw_info_format (NDI_UNIQUE, 0, op, "Your verbose level is now %d.", i);
477 return 1; 446 return 1;
478} 447}
479 448
480/* Prints out some useful information for the character. Everything we print 449/* Prints out some useful information for the character. Everything we print
481 * out can be determined by the docs, so we aren't revealing anything extra - 450 * out can be determined by the docs, so we aren't revealing anything extra -
514int 483int
515command_fix_me (object *op, char *params) 484command_fix_me (object *op, char *params)
516{ 485{
517 sum_weight (op); 486 sum_weight (op);
518 op->update_stats (); 487 op->update_stats ();
488 new_draw_info (NDI_UNIQUE, 0, op, "Your character was fixed.");
489
519 return 1; 490 return 1;
520} 491}
521 492
522int 493int
523command_logs (object *op, char *params) 494command_logs (object *op, char *params)
524{ 495{
525 new_draw_info (NDI_UNIQUE, 0, op, "Nobody is currently logging kills."); 496 new_draw_info (NDI_UNIQUE, 0, op, "Nobody is currently logging kills.");
526 497
527 return 1;
528}
529
530int
531command_applymode (object *op, char *params)
532{
533 unapplymode unapply = op->contr->unapply;
534 static const char *const types[] = { "nochoice", "never", "always" };
535
536 if (!params)
537 {
538 new_draw_info_format (NDI_UNIQUE, 0, op, "applymode is set to %s", types[op->contr->unapply]);
539 return 1;
540 }
541
542 if (!strcmp (params, "nochoice"))
543 op->contr->unapply = unapply_nochoice;
544 else if (!strcmp (params, "never"))
545 op->contr->unapply = unapply_never;
546 else if (!strcmp (params, "always"))
547 op->contr->unapply = unapply_always;
548 else
549 {
550 new_draw_info_format (NDI_UNIQUE, 0, op, "applymode: Unknown options %s, valid options are nochoice, never, always", params);
551 return 0;
552 }
553
554 new_draw_info_format (NDI_UNIQUE, 0, op, "Applymode %s set to %s",
555 (unapply == op->contr->unapply ? "" : " now"), types[op->contr->unapply]);
556 return 1; 498 return 1;
557} 499}
558 500
559int 501int
560command_bowmode (object *op, char *params) 502command_bowmode (object *op, char *params)
598 new_draw_info_format (NDI_UNIQUE, 0, op, buf); 540 new_draw_info_format (NDI_UNIQUE, 0, op, buf);
599 return 0; 541 return 0;
600 } 542 }
601 543
602 new_draw_info_format (NDI_UNIQUE, 0, op, "bowmode %s set to %s", (oldtype == op->contr->bowtype ? "" : "now"), types[op->contr->bowtype]); 544 new_draw_info_format (NDI_UNIQUE, 0, op, "bowmode %s set to %s", (oldtype == op->contr->bowtype ? "" : "now"), types[op->contr->bowtype]);
603 return 1;
604}
605
606int
607command_petmode (object *op, char *params)
608{
609 petmode_t oldtype = op->contr->petmode;
610 static const char *const types[] = { "normal", "sad", "defend", "arena" };
611
612 if (!params)
613 {
614 new_draw_info_format (NDI_UNIQUE, 0, op, "petmode is set to %s", types[op->contr->petmode]);
615 return 1;
616 }
617
618 if (!strcmp (params, "normal"))
619 op->contr->petmode = pet_normal;
620 else if (!strcmp (params, "sad"))
621 op->contr->petmode = pet_sad;
622 else if (!strcmp (params, "defend"))
623 op->contr->petmode = pet_defend;
624 else if (!strcmp (params, "arena"))
625 op->contr->petmode = pet_arena;
626 else
627 {
628 new_draw_info_format (NDI_UNIQUE, 0, op,
629 "petmode: Unknown options %s, valid options are normal," "sad (seek and destroy), defend, arena", params);
630 return 0;
631 }
632 new_draw_info_format (NDI_UNIQUE, 0, op, "petmode %s set to %s", (oldtype == op->contr->petmode ? "" : "now"), types[op->contr->petmode]);
633 return 1; 545 return 1;
634} 546}
635 547
636int 548int
637command_showpets (object *op, char *params) 549command_showpets (object *op, char *params)
678 new_draw_info (NDI_UNIQUE, 0, op, "no such pet."); 590 new_draw_info (NDI_UNIQUE, 0, op, "no such pet.");
679 return 0; 591 return 0;
680} 592}
681 593
682int 594int
683command_usekeys (object *op, char *params)
684{
685 usekeytype oldtype = op->contr->usekeys;
686 static const char *const types[] = { "inventory", "keyrings", "containers" };
687
688 if (!params)
689 {
690 new_draw_info_format (NDI_UNIQUE, 0, op, "usekeys is set to %s", types[op->contr->usekeys]);
691 return 1;
692 }
693
694 if (!strcmp (params, "inventory"))
695 op->contr->usekeys = key_inventory;
696 else if (!strcmp (params, "keyrings"))
697 op->contr->usekeys = keyrings;
698 else if (!strcmp (params, "containers"))
699 op->contr->usekeys = containers;
700 else
701 {
702 new_draw_info_format (NDI_UNIQUE, 0, op, "usekeys: Unknown options %s, valid options are inventory, keyrings, containers", params);
703 return 0;
704 }
705 new_draw_info_format (NDI_UNIQUE, 0, op, "usekeys %s set to %s", (oldtype == op->contr->usekeys ? "" : "now"), types[op->contr->usekeys]);
706 return 1;
707}
708
709int
710command_resistances (object *op, char *params) 595command_resistances (object *op, char *params)
711{ 596{
712 int i; 597 int i;
713 598
714 if (!op) 599 if (!op)
997 return 0; 882 return 0;
998 } 883 }
999} 884}
1000 885
1001int 886int
1002command_sound (object *op, char *params)
1003{
1004 if (op->contr->ns->sound)
1005 {
1006 op->contr->ns->sound = 0;
1007 new_draw_info (NDI_UNIQUE, 0, op, "Silence is golden...");
1008 }
1009 else
1010 {
1011 op->contr->ns->sound = 1;
1012 new_draw_info (NDI_UNIQUE, 0, op, "The sounds are enabled.");
1013 }
1014
1015 return 1;
1016}
1017
1018int
1019command_title (object *op, char *params) 887command_title (object *op, char *params)
1020{ 888{
1021 char buf[MAX_BUF]; 889 char buf[MAX_BUF];
1022 890
1023 if (settings.set_title == FALSE) 891 if (settings.set_title == FALSE)
1057 new_draw_info (NDI_UNIQUE, 0, op, "Title too long."); 925 new_draw_info (NDI_UNIQUE, 0, op, "Title too long.");
1058 return 1; 926 return 1;
1059 } 927 }
1060 strcpy (op->contr->own_title, params); 928 strcpy (op->contr->own_title, params);
1061 return 1; 929 return 1;
1062}
1063
1064int
1065command_peaceful (object *op, char *params)
1066{
1067 new_draw_info (NDI_UNIQUE, 0, op,
1068 "You cannot change your peaceful setting with this command."
1069 " Please speak to the priest in the temple of Gorokh"
1070 " if you want to become hostile or in temple of Valriel" " if you want to become peaceful again.");
1071
1072/*
1073 if((op->contr->peaceful=!op->contr->peaceful))
1074 new_draw_info(NDI_UNIQUE, 0,op,"You will not attack other players.");
1075 else
1076 new_draw_info(NDI_UNIQUE, 0,op,"You will attack other players.");
1077*/
1078 return 1;
1079}
1080
1081int
1082command_wimpy (object *op, char *params)
1083{
1084 int i;
1085 char buf[MAX_BUF];
1086
1087 if (params == NULL || !sscanf (params, "%d", &i))
1088 {
1089 sprintf (buf, "Your current wimpy level is %d.", op->run_away);
1090 new_draw_info (NDI_UNIQUE, 0, op, buf);
1091 return 1;
1092 }
1093 sprintf (buf, "Your new wimpy level is %d.", i);
1094 new_draw_info (NDI_UNIQUE, 0, op, buf);
1095 op->run_away = i;
1096 return 1;
1097}
1098
1099int
1100command_brace (object *op, char *params)
1101{
1102 if (!params)
1103 op->contr->braced = !op->contr->braced;
1104 else
1105 op->contr->braced = onoff_value (params);
1106
1107 if (op->contr->braced)
1108 new_draw_info (NDI_UNIQUE, 0, op, "You are braced.");
1109 else
1110 new_draw_info (NDI_UNIQUE, 0, op, "Not braced.");
1111
1112 op->update_stats ();
1113 return 0;
1114} 930}
1115 931
1116int 932int
1117command_kill_pets (object *op, char *params) 933command_kill_pets (object *op, char *params)
1118{ 934{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines