… | |
… | |
69 | { |
69 | { |
70 | display_motd (op); |
70 | display_motd (op); |
71 | return 1; |
71 | return 1; |
72 | } |
72 | } |
73 | |
73 | |
74 | int |
|
|
75 | command_bug (object *op, char *params) |
|
|
76 | { |
|
|
77 | char buf[MAX_BUF]; |
|
|
78 | |
|
|
79 | if (params == NULL) |
|
|
80 | { |
|
|
81 | new_draw_info (NDI_UNIQUE, 0, op, "what bugs?"); |
|
|
82 | return 1; |
|
|
83 | } |
|
|
84 | strcpy (buf, op->name); |
|
|
85 | strcat (buf, " bug-reports: "); |
|
|
86 | strncat (buf, ++params, MAX_BUF - strlen (buf)); |
|
|
87 | buf[MAX_BUF - 1] = '\0'; |
|
|
88 | bug_report (buf); |
|
|
89 | LOG (llevError, "%s\n", buf); |
|
|
90 | new_draw_info (NDI_ALL | NDI_UNIQUE, 1, NULL, buf); |
|
|
91 | new_draw_info (NDI_UNIQUE, 0, op, "OK, thanks!"); |
|
|
92 | return 1; |
|
|
93 | } |
|
|
94 | |
|
|
95 | /* |
74 | /* |
96 | * Pretty much identical to current map_info, but on a bigger scale |
75 | * Pretty much identical to current map_info, but on a bigger scale |
97 | * This function returns the name of the players current region, and |
76 | * This function returns the name of the players current region, and |
98 | * a description of it. It is there merely for flavour text. |
77 | * a description of it. It is there merely for flavour text. |
99 | */ |
78 | */ |
100 | void |
79 | void |
101 | current_region_info (object *op) |
80 | current_region_info (object *op) |
102 | { |
81 | { |
103 | if (region *reg = op->region ()) |
82 | if (region *reg = op->region ()) |
104 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are in %s.\n%s", ®->longname, ®->msg); |
83 | new_draw_info_format (NDI_UNIQUE, 0, op, "You are %s.\n%s", ®->longname, ®->msg); |
105 | } |
84 | } |
106 | |
85 | |
107 | void |
86 | void |
108 | current_map_info (object *op) |
87 | current_map_info (object *op) |
109 | { |
88 | { |
110 | maptile *m = op->map; |
89 | maptile *m = op->map; |
111 | |
90 | |
112 | if (!m) |
91 | if (!m) |
113 | return; |
92 | return; |
114 | |
93 | |
115 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s (%s) in %s", &m->name, &m->path, &op->region ()->name); |
94 | new_draw_info_format (NDI_UNIQUE, 0, op, "%s (%s) %s", &m->name, &m->path, &op->region ()->longname); |
116 | |
95 | |
117 | if (QUERY_FLAG (op, FLAG_WIZ)) |
96 | if (QUERY_FLAG (op, FLAG_WIZ)) |
118 | new_draw_info_format (NDI_UNIQUE, 0, op, |
97 | new_draw_info_format (NDI_UNIQUE, 0, op, |
119 | "players:%d difficulty:%d size:%dx%d start:%dx%d timeout %ld", |
98 | "players:%d difficulty:%d size:%dx%d start:%dx%d timeout %ld", |
120 | m->players, m->difficulty, m->width, m->height, m->enter_x, m->enter_y, m->timeout); |
99 | m->players, m->difficulty, m->width, m->height, m->enter_x, m->enter_y, m->timeout); |
… | |
… | |
170 | |
149 | |
171 | new_draw_info_format (NDI_UNIQUE, 0, op, "In the world currently there are:"); |
150 | new_draw_info_format (NDI_UNIQUE, 0, op, "In the world currently there are:"); |
172 | |
151 | |
173 | for_all_regions (rgn) |
152 | for_all_regions (rgn) |
174 | if (rgn->counter) |
153 | if (rgn->counter) |
175 | new_draw_info_format (NDI_UNIQUE, 0, op, "%u players in %s", rgn->counter, &rgn->longname); |
154 | new_draw_info_format (NDI_UNIQUE, 0, op, "%u players %s", rgn->counter, &rgn->longname); |
176 | |
155 | |
177 | return 1; |
156 | return 1; |
178 | } |
157 | } |
179 | |
158 | |
180 | typedef struct |
159 | typedef struct |
181 | { |
160 | { |
182 | char namebuf[MAX_BUF]; |
161 | char namebuf[MAX_BUF]; |
183 | int login_order; |
162 | int login_order; |
184 | } chars_names; |
163 | } chars_names; |
185 | |
|
|
186 | int |
|
|
187 | command_afk (object *op, char *params) |
|
|
188 | { |
|
|
189 | if ((op->contr->ns->afk = !op->contr->ns->afk)) |
|
|
190 | new_draw_info (NDI_UNIQUE, 0, op, "You are no longer AFK"); |
|
|
191 | else |
|
|
192 | new_draw_info (NDI_UNIQUE, 0, op, "You are now AFK"); |
|
|
193 | |
|
|
194 | return 1; |
|
|
195 | } |
|
|
196 | |
164 | |
197 | int |
165 | int |
198 | command_mapinfo (object *op, char *params) |
166 | command_mapinfo (object *op, char *params) |
199 | { |
167 | { |
200 | current_map_info (op); |
168 | current_map_info (op); |
… | |
… | |
365 | { |
333 | { |
366 | sprintf (buf, "Global debug level is %d.", settings.debug); |
334 | sprintf (buf, "Global debug level is %d.", settings.debug); |
367 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
335 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
368 | return 1; |
336 | return 1; |
369 | } |
337 | } |
370 | if (op != NULL && !QUERY_FLAG (op, FLAG_WIZ)) |
|
|
371 | { |
|
|
372 | new_draw_info (NDI_UNIQUE, 0, op, "Privileged command."); |
|
|
373 | return 1; |
|
|
374 | } |
|
|
375 | settings.debug = (enum LogLevel) FABS (i); |
338 | settings.debug = (enum LogLevel) FABS (i); |
376 | sprintf (buf, "Set debug level to %d.", i); |
339 | sprintf (buf, "Set debug level to %d.", i); |
377 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
340 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
378 | return 1; |
341 | return 1; |
379 | } |
342 | } |
… | |
… | |
478 | 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); |
479 | } |
442 | } |
480 | else |
443 | else |
481 | 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."); |
482 | |
445 | |
483 | return 1; |
|
|
484 | } |
|
|
485 | |
|
|
486 | int |
|
|
487 | command_listen (object *op, char *params) |
|
|
488 | { |
|
|
489 | int i; |
|
|
490 | |
|
|
491 | if (params == NULL || !sscanf (params, "%d", &i)) |
|
|
492 | { |
|
|
493 | new_draw_info_format (NDI_UNIQUE, 0, op, "Set listen to what (presently %d)?", op->contr->listening); |
|
|
494 | return 1; |
|
|
495 | } |
|
|
496 | op->contr->listening = (char) i; |
|
|
497 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your verbose level is now %d.", i); |
|
|
498 | return 1; |
446 | return 1; |
499 | } |
447 | } |
500 | |
448 | |
501 | /* Prints out some useful information for the character. Everything we print |
449 | /* Prints out some useful information for the character. Everything we print |
502 | * 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 - |
… | |
… | |
535 | int |
483 | int |
536 | command_fix_me (object *op, char *params) |
484 | command_fix_me (object *op, char *params) |
537 | { |
485 | { |
538 | sum_weight (op); |
486 | sum_weight (op); |
539 | op->update_stats (); |
487 | op->update_stats (); |
|
|
488 | new_draw_info (NDI_UNIQUE, 0, op, "Your character was fixed."); |
|
|
489 | |
540 | return 1; |
490 | return 1; |
541 | } |
491 | } |
542 | |
492 | |
543 | int |
493 | int |
544 | command_logs (object *op, char *params) |
494 | command_logs (object *op, char *params) |
545 | { |
495 | { |
546 | 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."); |
547 | |
497 | |
548 | return 1; |
|
|
549 | } |
|
|
550 | |
|
|
551 | int |
|
|
552 | command_applymode (object *op, char *params) |
|
|
553 | { |
|
|
554 | unapplymode unapply = op->contr->unapply; |
|
|
555 | static const char *const types[] = { "nochoice", "never", "always" }; |
|
|
556 | |
|
|
557 | if (!params) |
|
|
558 | { |
|
|
559 | new_draw_info_format (NDI_UNIQUE, 0, op, "applymode is set to %s", types[op->contr->unapply]); |
|
|
560 | return 1; |
|
|
561 | } |
|
|
562 | |
|
|
563 | if (!strcmp (params, "nochoice")) |
|
|
564 | op->contr->unapply = unapply_nochoice; |
|
|
565 | else if (!strcmp (params, "never")) |
|
|
566 | op->contr->unapply = unapply_never; |
|
|
567 | else if (!strcmp (params, "always")) |
|
|
568 | op->contr->unapply = unapply_always; |
|
|
569 | else |
|
|
570 | { |
|
|
571 | new_draw_info_format (NDI_UNIQUE, 0, op, "applymode: Unknown options %s, valid options are nochoice, never, always", params); |
|
|
572 | return 0; |
|
|
573 | } |
|
|
574 | |
|
|
575 | new_draw_info_format (NDI_UNIQUE, 0, op, "Applymode %s set to %s", |
|
|
576 | (unapply == op->contr->unapply ? "" : " now"), types[op->contr->unapply]); |
|
|
577 | return 1; |
498 | return 1; |
578 | } |
499 | } |
579 | |
500 | |
580 | int |
501 | int |
581 | command_bowmode (object *op, char *params) |
502 | command_bowmode (object *op, char *params) |
… | |
… | |
619 | new_draw_info_format (NDI_UNIQUE, 0, op, buf); |
540 | new_draw_info_format (NDI_UNIQUE, 0, op, buf); |
620 | return 0; |
541 | return 0; |
621 | } |
542 | } |
622 | |
543 | |
623 | 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]); |
624 | return 1; |
|
|
625 | } |
|
|
626 | |
|
|
627 | int |
|
|
628 | command_petmode (object *op, char *params) |
|
|
629 | { |
|
|
630 | petmode_t oldtype = op->contr->petmode; |
|
|
631 | static const char *const types[] = { "normal", "sad", "defend", "arena" }; |
|
|
632 | |
|
|
633 | if (!params) |
|
|
634 | { |
|
|
635 | new_draw_info_format (NDI_UNIQUE, 0, op, "petmode is set to %s", types[op->contr->petmode]); |
|
|
636 | return 1; |
|
|
637 | } |
|
|
638 | |
|
|
639 | if (!strcmp (params, "normal")) |
|
|
640 | op->contr->petmode = pet_normal; |
|
|
641 | else if (!strcmp (params, "sad")) |
|
|
642 | op->contr->petmode = pet_sad; |
|
|
643 | else if (!strcmp (params, "defend")) |
|
|
644 | op->contr->petmode = pet_defend; |
|
|
645 | else if (!strcmp (params, "arena")) |
|
|
646 | op->contr->petmode = pet_arena; |
|
|
647 | else |
|
|
648 | { |
|
|
649 | new_draw_info_format (NDI_UNIQUE, 0, op, |
|
|
650 | "petmode: Unknown options %s, valid options are normal," "sad (seek and destroy), defend, arena", params); |
|
|
651 | return 0; |
|
|
652 | } |
|
|
653 | new_draw_info_format (NDI_UNIQUE, 0, op, "petmode %s set to %s", (oldtype == op->contr->petmode ? "" : "now"), types[op->contr->petmode]); |
|
|
654 | return 1; |
545 | return 1; |
655 | } |
546 | } |
656 | |
547 | |
657 | int |
548 | int |
658 | command_showpets (object *op, char *params) |
549 | command_showpets (object *op, char *params) |
… | |
… | |
699 | new_draw_info (NDI_UNIQUE, 0, op, "no such pet."); |
590 | new_draw_info (NDI_UNIQUE, 0, op, "no such pet."); |
700 | return 0; |
591 | return 0; |
701 | } |
592 | } |
702 | |
593 | |
703 | int |
594 | int |
704 | command_usekeys (object *op, char *params) |
|
|
705 | { |
|
|
706 | usekeytype oldtype = op->contr->usekeys; |
|
|
707 | static const char *const types[] = { "inventory", "keyrings", "containers" }; |
|
|
708 | |
|
|
709 | if (!params) |
|
|
710 | { |
|
|
711 | new_draw_info_format (NDI_UNIQUE, 0, op, "usekeys is set to %s", types[op->contr->usekeys]); |
|
|
712 | return 1; |
|
|
713 | } |
|
|
714 | |
|
|
715 | if (!strcmp (params, "inventory")) |
|
|
716 | op->contr->usekeys = key_inventory; |
|
|
717 | else if (!strcmp (params, "keyrings")) |
|
|
718 | op->contr->usekeys = keyrings; |
|
|
719 | else if (!strcmp (params, "containers")) |
|
|
720 | op->contr->usekeys = containers; |
|
|
721 | else |
|
|
722 | { |
|
|
723 | new_draw_info_format (NDI_UNIQUE, 0, op, "usekeys: Unknown options %s, valid options are inventory, keyrings, containers", params); |
|
|
724 | return 0; |
|
|
725 | } |
|
|
726 | new_draw_info_format (NDI_UNIQUE, 0, op, "usekeys %s set to %s", (oldtype == op->contr->usekeys ? "" : "now"), types[op->contr->usekeys]); |
|
|
727 | return 1; |
|
|
728 | } |
|
|
729 | |
|
|
730 | int |
|
|
731 | command_resistances (object *op, char *params) |
595 | command_resistances (object *op, char *params) |
732 | { |
596 | { |
733 | int i; |
597 | int i; |
734 | |
598 | |
735 | if (!op) |
599 | if (!op) |
… | |
… | |
801 | |
665 | |
802 | if (!(dirp = opendir (filename))) |
666 | if (!(dirp = opendir (filename))) |
803 | return; |
667 | return; |
804 | |
668 | |
805 | line[0] = '\0'; |
669 | line[0] = '\0'; |
806 | while (de = readdir (dirp)) |
670 | while ((de = readdir (dirp))) |
807 | { |
671 | { |
808 | namelen = strlen (de->d_name); |
672 | namelen = strlen (de->d_name); |
809 | if (namelen <= 2 && *de->d_name == '.' && (namelen == 1 || de->d_name[1] == '.')) |
673 | if (namelen <= 2 && *de->d_name == '.' && (namelen == 1 || de->d_name[1] == '.')) |
810 | continue; |
674 | continue; |
811 | linelen += namelen + 1; |
675 | linelen += namelen + 1; |
… | |
… | |
1018 | return 0; |
882 | return 0; |
1019 | } |
883 | } |
1020 | } |
884 | } |
1021 | |
885 | |
1022 | int |
886 | int |
1023 | command_sound (object *op, char *params) |
|
|
1024 | { |
|
|
1025 | if (op->contr->ns->sound) |
|
|
1026 | { |
|
|
1027 | op->contr->ns->sound = 0; |
|
|
1028 | new_draw_info (NDI_UNIQUE, 0, op, "Silence is golden..."); |
|
|
1029 | } |
|
|
1030 | else |
|
|
1031 | { |
|
|
1032 | op->contr->ns->sound = 1; |
|
|
1033 | new_draw_info (NDI_UNIQUE, 0, op, "The sounds are enabled."); |
|
|
1034 | } |
|
|
1035 | |
|
|
1036 | return 1; |
|
|
1037 | } |
|
|
1038 | |
|
|
1039 | int |
|
|
1040 | command_title (object *op, char *params) |
887 | command_title (object *op, char *params) |
1041 | { |
888 | { |
1042 | char buf[MAX_BUF]; |
889 | char buf[MAX_BUF]; |
1043 | |
890 | |
1044 | if (settings.set_title == FALSE) |
891 | if (settings.set_title == FALSE) |
… | |
… | |
1078 | new_draw_info (NDI_UNIQUE, 0, op, "Title too long."); |
925 | new_draw_info (NDI_UNIQUE, 0, op, "Title too long."); |
1079 | return 1; |
926 | return 1; |
1080 | } |
927 | } |
1081 | strcpy (op->contr->own_title, params); |
928 | strcpy (op->contr->own_title, params); |
1082 | return 1; |
929 | return 1; |
1083 | } |
|
|
1084 | |
|
|
1085 | int |
|
|
1086 | command_peaceful (object *op, char *params) |
|
|
1087 | { |
|
|
1088 | new_draw_info (NDI_UNIQUE, 0, op, |
|
|
1089 | "You cannot change your peaceful setting with this command." |
|
|
1090 | " Please speak to the priest in the temple of Gorokh" |
|
|
1091 | " if you want to become hostile or in temple of Valriel" " if you want to become peaceful again."); |
|
|
1092 | |
|
|
1093 | /* |
|
|
1094 | if((op->contr->peaceful=!op->contr->peaceful)) |
|
|
1095 | new_draw_info(NDI_UNIQUE, 0,op,"You will not attack other players."); |
|
|
1096 | else |
|
|
1097 | new_draw_info(NDI_UNIQUE, 0,op,"You will attack other players."); |
|
|
1098 | */ |
|
|
1099 | return 1; |
|
|
1100 | } |
|
|
1101 | |
|
|
1102 | int |
|
|
1103 | command_wimpy (object *op, char *params) |
|
|
1104 | { |
|
|
1105 | int i; |
|
|
1106 | char buf[MAX_BUF]; |
|
|
1107 | |
|
|
1108 | if (params == NULL || !sscanf (params, "%d", &i)) |
|
|
1109 | { |
|
|
1110 | sprintf (buf, "Your current wimpy level is %d.", op->run_away); |
|
|
1111 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
|
|
1112 | return 1; |
|
|
1113 | } |
|
|
1114 | sprintf (buf, "Your new wimpy level is %d.", i); |
|
|
1115 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
|
|
1116 | op->run_away = i; |
|
|
1117 | return 1; |
|
|
1118 | } |
|
|
1119 | |
|
|
1120 | int |
|
|
1121 | command_brace (object *op, char *params) |
|
|
1122 | { |
|
|
1123 | if (!params) |
|
|
1124 | op->contr->braced = !op->contr->braced; |
|
|
1125 | else |
|
|
1126 | op->contr->braced = onoff_value (params); |
|
|
1127 | |
|
|
1128 | if (op->contr->braced) |
|
|
1129 | new_draw_info (NDI_UNIQUE, 0, op, "You are braced."); |
|
|
1130 | else |
|
|
1131 | new_draw_info (NDI_UNIQUE, 0, op, "Not braced."); |
|
|
1132 | |
|
|
1133 | op->update_stats (); |
|
|
1134 | return 0; |
|
|
1135 | } |
930 | } |
1136 | |
931 | |
1137 | int |
932 | int |
1138 | command_kill_pets (object *op, char *params) |
933 | command_kill_pets (object *op, char *params) |
1139 | { |
934 | { |