… | |
… | |
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 | |
165 | int |
165 | int |
166 | command_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 | |
|
|
176 | int |
|
|
177 | command_mapinfo (object *op, char *params) |
166 | command_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 | } |
… | |
… | |
414 | } |
398 | } |
415 | else |
399 | else |
416 | { |
400 | { |
417 | 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)); |
418 | } |
402 | } |
419 | } |
|
|
420 | |
|
|
421 | int |
|
|
422 | command_output_sync (object *op, char *params) |
|
|
423 | { |
|
|
424 | int val; |
|
|
425 | |
|
|
426 | if (!params) |
|
|
427 | { |
|
|
428 | new_draw_info_format (NDI_UNIQUE, 0, op, "Output sync time is presently %d", op->contr->outputs_sync); |
|
|
429 | return 1; |
|
|
430 | } |
|
|
431 | val = atoi (params); |
|
|
432 | if (val > 0) |
|
|
433 | { |
|
|
434 | op->contr->outputs_sync = val; |
|
|
435 | new_draw_info_format (NDI_UNIQUE, 0, op, "Output sync time now set to %d", op->contr->outputs_sync); |
|
|
436 | } |
|
|
437 | else |
|
|
438 | new_draw_info (NDI_UNIQUE, 0, op, "Invalid value for output_sync."); |
|
|
439 | |
|
|
440 | return 1; |
|
|
441 | } |
|
|
442 | |
|
|
443 | int |
|
|
444 | command_output_count (object *op, char *params) |
|
|
445 | { |
|
|
446 | int val; |
|
|
447 | |
|
|
448 | if (!params) |
|
|
449 | { |
|
|
450 | new_draw_info_format (NDI_UNIQUE, 0, op, "Output count is presently %d", op->contr->outputs_count); |
|
|
451 | return 1; |
|
|
452 | } |
|
|
453 | val = atoi (params); |
|
|
454 | if (val > 0) |
|
|
455 | { |
|
|
456 | op->contr->outputs_count = val; |
|
|
457 | new_draw_info_format (NDI_UNIQUE, 0, op, "Output count now set to %d", op->contr->outputs_count); |
|
|
458 | } |
|
|
459 | else |
|
|
460 | new_draw_info (NDI_UNIQUE, 0, op, "Invalid value for output_count."); |
|
|
461 | |
|
|
462 | return 1; |
|
|
463 | } |
|
|
464 | |
|
|
465 | int |
|
|
466 | command_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; |
|
|
478 | } |
403 | } |
479 | |
404 | |
480 | /* Prints out some useful information for the character. Everything we print |
405 | /* 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 - |
406 | * out can be determined by the docs, so we aren't revealing anything extra - |
482 | * 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 |
… | |
… | |
514 | int |
439 | int |
515 | command_fix_me (object *op, char *params) |
440 | command_fix_me (object *op, char *params) |
516 | { |
441 | { |
517 | sum_weight (op); |
442 | sum_weight (op); |
518 | op->update_stats (); |
443 | op->update_stats (); |
|
|
444 | new_draw_info (NDI_UNIQUE, 0, op, "Your character was fixed."); |
|
|
445 | |
519 | return 1; |
446 | return 1; |
520 | } |
447 | } |
521 | |
448 | |
522 | int |
449 | int |
523 | command_logs (object *op, char *params) |
450 | command_logs (object *op, char *params) |
524 | { |
451 | { |
525 | 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."); |
526 | |
453 | |
527 | return 1; |
|
|
528 | } |
|
|
529 | |
|
|
530 | int |
|
|
531 | command_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; |
454 | return 1; |
557 | } |
455 | } |
558 | |
456 | |
559 | int |
457 | int |
560 | command_bowmode (object *op, char *params) |
458 | command_bowmode (object *op, char *params) |
… | |
… | |
598 | new_draw_info_format (NDI_UNIQUE, 0, op, buf); |
496 | new_draw_info_format (NDI_UNIQUE, 0, op, buf); |
599 | return 0; |
497 | return 0; |
600 | } |
498 | } |
601 | |
499 | |
602 | 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]); |
603 | return 1; |
|
|
604 | } |
|
|
605 | |
|
|
606 | int |
|
|
607 | command_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; |
501 | return 1; |
634 | } |
502 | } |
635 | |
503 | |
636 | int |
504 | int |
637 | command_showpets (object *op, char *params) |
505 | command_showpets (object *op, char *params) |
… | |
… | |
678 | new_draw_info (NDI_UNIQUE, 0, op, "no such pet."); |
546 | new_draw_info (NDI_UNIQUE, 0, op, "no such pet."); |
679 | return 0; |
547 | return 0; |
680 | } |
548 | } |
681 | |
549 | |
682 | int |
550 | int |
683 | command_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 | |
|
|
709 | int |
|
|
710 | command_resistances (object *op, char *params) |
551 | command_resistances (object *op, char *params) |
711 | { |
552 | { |
712 | int i; |
553 | int i; |
713 | |
554 | |
714 | if (!op) |
555 | if (!op) |
… | |
… | |
997 | return 0; |
838 | return 0; |
998 | } |
839 | } |
999 | } |
840 | } |
1000 | |
841 | |
1001 | int |
842 | int |
1002 | command_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 | |
|
|
1018 | int |
|
|
1019 | command_title (object *op, char *params) |
843 | command_title (object *op, char *params) |
1020 | { |
844 | { |
1021 | char buf[MAX_BUF]; |
845 | char buf[MAX_BUF]; |
1022 | |
846 | |
1023 | if (settings.set_title == FALSE) |
847 | if (settings.set_title == FALSE) |
… | |
… | |
1057 | new_draw_info (NDI_UNIQUE, 0, op, "Title too long."); |
881 | new_draw_info (NDI_UNIQUE, 0, op, "Title too long."); |
1058 | return 1; |
882 | return 1; |
1059 | } |
883 | } |
1060 | strcpy (op->contr->own_title, params); |
884 | strcpy (op->contr->own_title, params); |
1061 | return 1; |
885 | return 1; |
1062 | } |
|
|
1063 | |
|
|
1064 | int |
|
|
1065 | command_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 | |
|
|
1081 | int |
|
|
1082 | command_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 | |
|
|
1099 | int |
|
|
1100 | command_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 | } |
886 | } |
1115 | |
887 | |
1116 | int |
888 | int |
1117 | command_kill_pets (object *op, char *params) |
889 | command_kill_pets (object *op, char *params) |
1118 | { |
890 | { |