1 |
/* |
2 |
* CrossFire, A Multiplayer game for X-windows |
3 |
* |
4 |
* Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 |
* Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 |
* Copyright (C) 1992 Frank Tore Johansen |
7 |
* |
8 |
* This program is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License as published by |
10 |
* the Free Software Foundation; either version 2 of the License, or |
11 |
* (at your option) any later version. |
12 |
* |
13 |
* This program is distributed in the hope that it will be useful, |
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
* GNU General Public License for more details. |
17 |
* |
18 |
* You should have received a copy of the GNU General Public License |
19 |
* along with this program; if not, write to the Free Software |
20 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 |
* |
22 |
* The authors can be reached via e-mail at <crossfire@schmorp.de> |
23 |
*/ |
24 |
|
25 |
#include <global.h> |
26 |
#include <loader.h> |
27 |
#include <sproto.h> |
28 |
|
29 |
/* Handles misc. input request - things like hash table, malloc, maps, |
30 |
* who, etc. |
31 |
*/ |
32 |
|
33 |
/* This command dumps the body information for object *op. |
34 |
* it doesn't care what the params are. |
35 |
* This is mostly meant as a debug command. |
36 |
*/ |
37 |
int |
38 |
command_body (object *op, char *params) |
39 |
{ |
40 |
int i; |
41 |
|
42 |
/* Too hard to try and make a header that lines everything up, so just |
43 |
* give a description. |
44 |
*/ |
45 |
new_draw_info (NDI_UNIQUE, 0, op, "The first column is the name of the body location."); |
46 |
new_draw_info (NDI_UNIQUE, 0, op, "The second column is how many of those locations your body has."); |
47 |
new_draw_info (NDI_UNIQUE, 0, op, "The third column is how many slots in that location are available."); |
48 |
for (i = 0; i < NUM_BODY_LOCATIONS; i++) |
49 |
{ |
50 |
/* really debugging - normally body_used should not be set to anything |
51 |
* if body_info isn't also set. |
52 |
*/ |
53 |
if (op->body_info[i] || op->body_used[i]) |
54 |
{ |
55 |
new_draw_info_format (NDI_UNIQUE, 0, op, "%-30s %5d %5d", body_locations[i].use_name, op->body_info[i], op->body_used[i]); |
56 |
} |
57 |
} |
58 |
if (!QUERY_FLAG (op, FLAG_USE_ARMOUR)) |
59 |
new_draw_info (NDI_UNIQUE, 0, op, "You are not allowed to wear armor"); |
60 |
if (!QUERY_FLAG (op, FLAG_USE_WEAPON)) |
61 |
new_draw_info (NDI_UNIQUE, 0, op, "You are not allowed to use weapons"); |
62 |
|
63 |
return 1; |
64 |
} |
65 |
|
66 |
|
67 |
int |
68 |
command_motd (object *op, char *params) |
69 |
{ |
70 |
display_motd (op); |
71 |
return 1; |
72 |
} |
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 |
/* |
96 |
* Pretty much identical to current map_info, but on a bigger scale |
97 |
* This function returns the name of the players current region, and |
98 |
* a description of it. It is there merely for flavour text. |
99 |
*/ |
100 |
void |
101 |
current_region_info (object *op) |
102 |
{ |
103 |
if (region *reg = op->region ()) |
104 |
new_draw_info_format (NDI_UNIQUE, 0, op, "You are in %s.\n%s", ®->longname, ®->msg); |
105 |
} |
106 |
|
107 |
void |
108 |
current_map_info (object *op) |
109 |
{ |
110 |
maptile *m = op->map; |
111 |
|
112 |
if (!m) |
113 |
return; |
114 |
|
115 |
new_draw_info_format (NDI_UNIQUE, 0, op, "%s (%s) in %s", &m->name, &m->path, &op->region ()->name); |
116 |
|
117 |
if (QUERY_FLAG (op, FLAG_WIZ)) |
118 |
new_draw_info_format (NDI_UNIQUE, 0, op, |
119 |
"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); |
121 |
|
122 |
if (m->msg) |
123 |
new_draw_info (NDI_UNIQUE, NDI_NAVY, op, m->msg); |
124 |
} |
125 |
|
126 |
#ifdef DEBUG_MALLOC_LEVEL |
127 |
int |
128 |
command_malloc_verify (object *op, char *parms) |
129 |
{ |
130 |
extern int malloc_verify (void); |
131 |
|
132 |
if (!malloc_verify ()) |
133 |
new_draw_info (NDI_UNIQUE, 0, op, "Heap is corrupted."); |
134 |
else |
135 |
new_draw_info (NDI_UNIQUE, 0, op, "Heap checks out OK."); |
136 |
return 1; |
137 |
} |
138 |
#endif |
139 |
|
140 |
int |
141 |
command_whereabouts (object *op, char *params) |
142 |
{ |
143 |
//TODO: should obviously not waste space in struct region for this. |
144 |
/* |
145 |
* reset the counter on the region, then use it to store the number of |
146 |
* players there. |
147 |
* I don't know how thread-safe this would be, I suspect not very.... |
148 |
*/ |
149 |
for_all_regions (rgn) |
150 |
rgn->counter = 0; |
151 |
|
152 |
for_all_players (pl) |
153 |
if (pl->ob->map) |
154 |
++pl->ob->region ()->counter; |
155 |
|
156 |
/* we only want to print out by places with a 'longname' field... */ |
157 |
for_all_regions (rgn) |
158 |
{ |
159 |
if (!rgn->longname && rgn->counter > 0) |
160 |
{ |
161 |
if (rgn->parent) |
162 |
{ |
163 |
rgn->parent->counter += rgn->counter; |
164 |
rgn->counter = 0; |
165 |
} |
166 |
else /*uh oh, we shouldn't be here. */ |
167 |
LOG (llevError, "command_whereabouts() Region %s with no longname has no parent", &rgn->name); |
168 |
} |
169 |
} |
170 |
|
171 |
new_draw_info_format (NDI_UNIQUE, 0, op, "In the world currently there are:"); |
172 |
|
173 |
for_all_regions (rgn) |
174 |
if (rgn->counter) |
175 |
new_draw_info_format (NDI_UNIQUE, 0, op, "%u players in %s", rgn->counter, &rgn->longname); |
176 |
|
177 |
return 1; |
178 |
} |
179 |
|
180 |
typedef struct |
181 |
{ |
182 |
char namebuf[MAX_BUF]; |
183 |
int login_order; |
184 |
} 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 |
|
197 |
int |
198 |
command_mapinfo (object *op, char *params) |
199 |
{ |
200 |
current_map_info (op); |
201 |
return 1; |
202 |
} |
203 |
|
204 |
int |
205 |
command_whereami (object *op, char *params) |
206 |
{ |
207 |
current_region_info (op); |
208 |
return 1; |
209 |
} |
210 |
|
211 |
int |
212 |
command_time (object *op, char *params) |
213 |
{ |
214 |
print_tod (op); |
215 |
return 1; |
216 |
} |
217 |
|
218 |
int |
219 |
command_weather (object *op, char *params) |
220 |
{ |
221 |
#if 0 |
222 |
int wx, wy, temp, sky; |
223 |
char buf[MAX_BUF]; |
224 |
|
225 |
if (settings.dynamiclevel < 1) |
226 |
return 1; |
227 |
|
228 |
if (op->map == NULL) |
229 |
return 1; |
230 |
|
231 |
if (worldmap_to_weathermap (op->x, op->y, &wx, &wy, op->map) != 0) |
232 |
return 1; |
233 |
|
234 |
if (QUERY_FLAG (op, FLAG_WIZ)) |
235 |
{ |
236 |
/* dump the weather, Dm style! Yo! */ |
237 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Real temp: %d", real_world_temperature (op->x, op->y, op->map)); |
238 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Base temp: %d", weathermap[wx][wy].temp); |
239 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Humid: %d", weathermap[wx][wy].humid); |
240 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Wind: dir=%d speed=%d", weathermap[wx][wy].winddir, weathermap[wx][wy].windspeed); |
241 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Pressure: %d", weathermap[wx][wy].pressure); |
242 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Avg Elevation: %d", weathermap[wx][wy].avgelev); |
243 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Rainfall: %d Water: %d", weathermap[wx][wy].rainfall, weathermap[wx][wy].water); |
244 |
} |
245 |
|
246 |
temp = real_world_temperature (op->x, op->y, op->map); |
247 |
new_draw_info_format (NDI_UNIQUE, 0, op, "It's currently %d degrees " "Centigrade out.", temp); |
248 |
|
249 |
/* humid */ |
250 |
if (weathermap[wx][wy].humid < 20) |
251 |
new_draw_info (NDI_UNIQUE, 0, op, "It is very dry."); |
252 |
else if (weathermap[wx][wy].humid < 40) |
253 |
new_draw_info (NDI_UNIQUE, 0, op, "It is very comfortable today."); |
254 |
else if (weathermap[wx][wy].humid < 60) |
255 |
new_draw_info (NDI_UNIQUE, 0, op, "It is a bit muggy."); |
256 |
else if (weathermap[wx][wy].humid < 80) |
257 |
new_draw_info (NDI_UNIQUE, 0, op, "It is muggy."); |
258 |
else |
259 |
new_draw_info (NDI_UNIQUE, 0, op, "It is uncomfortably muggy."); |
260 |
|
261 |
/* wind */ |
262 |
switch (weathermap[wx][wy].winddir) |
263 |
{ |
264 |
case 1: |
265 |
sprintf (buf, "north"); |
266 |
break; |
267 |
case 2: |
268 |
sprintf (buf, "northeast"); |
269 |
break; |
270 |
case 3: |
271 |
sprintf (buf, "east"); |
272 |
break; |
273 |
case 4: |
274 |
sprintf (buf, "southeast"); |
275 |
break; |
276 |
case 5: |
277 |
sprintf (buf, "south"); |
278 |
break; |
279 |
case 6: |
280 |
sprintf (buf, "southwest"); |
281 |
break; |
282 |
case 7: |
283 |
sprintf (buf, "west"); |
284 |
break; |
285 |
case 8: |
286 |
sprintf (buf, "northwest"); |
287 |
break; |
288 |
} |
289 |
if (weathermap[wx][wy].windspeed < 5) |
290 |
new_draw_info_format (NDI_UNIQUE, 0, op, "There is a mild breeze " "coming from the %s.", buf); |
291 |
else if (weathermap[wx][wy].windspeed < 10) |
292 |
new_draw_info_format (NDI_UNIQUE, 0, op, "There is a strong breeze " "coming from the %s.", buf); |
293 |
else if (weathermap[wx][wy].windspeed < 15) |
294 |
new_draw_info_format (NDI_UNIQUE, 0, op, "There is a light wind " "coming from the %s.", buf); |
295 |
else if (weathermap[wx][wy].windspeed < 25) |
296 |
new_draw_info_format (NDI_UNIQUE, 0, op, "There is a strong wind " "coming from the %s.", buf); |
297 |
else if (weathermap[wx][wy].windspeed < 35) |
298 |
new_draw_info_format (NDI_UNIQUE, 0, op, "There is a heavy wind " "coming from the %s.", buf); |
299 |
else |
300 |
new_draw_info_format (NDI_UNIQUE, 0, op, "The wind from the %s is " "incredibly strong!", buf); |
301 |
|
302 |
sky = weathermap[wx][wy].sky; |
303 |
if (temp <= 0 && sky > SKY_OVERCAST && sky < SKY_FOG) |
304 |
sky += 10; /*let it snow */ |
305 |
switch (sky) |
306 |
{ |
307 |
case SKY_CLEAR: |
308 |
new_draw_info (NDI_UNIQUE, 0, op, "There isn''t a cloud in the sky."); |
309 |
break; |
310 |
case SKY_LIGHTCLOUD: |
311 |
new_draw_info (NDI_UNIQUE, 0, op, "There are a few light clouds in the sky."); |
312 |
break; |
313 |
case SKY_OVERCAST: |
314 |
new_draw_info (NDI_UNIQUE, 0, op, "The sky is cloudy and dreary."); |
315 |
break; |
316 |
case SKY_LIGHT_RAIN: |
317 |
new_draw_info (NDI_UNIQUE, 0, op, "It is raining softly."); |
318 |
break; |
319 |
case SKY_RAIN: |
320 |
new_draw_info (NDI_UNIQUE, 0, op, "It is raining."); |
321 |
break; |
322 |
case SKY_HEAVY_RAIN: |
323 |
new_draw_info (NDI_UNIQUE, 0, op, "It is raining heavily."); |
324 |
break; |
325 |
case SKY_HURRICANE: |
326 |
new_draw_info (NDI_UNIQUE, 0, op, "There is a heavy storm! You should go inside!"); |
327 |
break; |
328 |
case SKY_FOG: |
329 |
new_draw_info (NDI_UNIQUE, 0, op, "It''s foggy and miserable."); |
330 |
break; |
331 |
case SKY_HAIL: |
332 |
new_draw_info (NDI_UNIQUE, 0, op, "It''s hailing out! Take cover!"); |
333 |
break; |
334 |
case SKY_LIGHT_SNOW: |
335 |
new_draw_info (NDI_UNIQUE, 0, op, "Snow is gently falling from the sky."); |
336 |
break; |
337 |
case SKY_SNOW: |
338 |
new_draw_info (NDI_UNIQUE, 0, op, "It''s snowing out."); |
339 |
break; |
340 |
case SKY_HEAVY_SNOW: |
341 |
new_draw_info (NDI_UNIQUE, 0, op, "The snow is falling very heavily now."); |
342 |
break; |
343 |
case SKY_BLIZZARD: |
344 |
new_draw_info (NDI_UNIQUE, 0, op, "A full blown blizzard is in effect. You might want to take cover!"); |
345 |
break; |
346 |
} |
347 |
#endif |
348 |
return 1; |
349 |
} |
350 |
|
351 |
int |
352 |
command_hiscore (object *op, char *params) |
353 |
{ |
354 |
display_high_score (op, op == NULL ? 9999 : 50, params); |
355 |
return 1; |
356 |
} |
357 |
|
358 |
int |
359 |
command_debug (object *op, char *params) |
360 |
{ |
361 |
int i; |
362 |
char buf[MAX_BUF]; |
363 |
|
364 |
if (params == NULL || !sscanf (params, "%d", &i)) |
365 |
{ |
366 |
sprintf (buf, "Global debug level is %d.", settings.debug); |
367 |
new_draw_info (NDI_UNIQUE, 0, op, buf); |
368 |
return 1; |
369 |
} |
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); |
376 |
sprintf (buf, "Set debug level to %d.", i); |
377 |
new_draw_info (NDI_UNIQUE, 0, op, buf); |
378 |
return 1; |
379 |
} |
380 |
|
381 |
|
382 |
/* |
383 |
* Those dumps should be just one dump with good parser |
384 |
*/ |
385 |
|
386 |
int |
387 |
command_dumpbelow (object *op, char *params) |
388 |
{ |
389 |
if (op && op->below) |
390 |
{ |
391 |
char *dump = dump_object (op->below); |
392 |
new_draw_info (NDI_UNIQUE, 0, op, dump); |
393 |
free (dump); |
394 |
/* Let's push that item on the dm's stack */ |
395 |
dm_stack_push (op->contr, op->below->count); |
396 |
} |
397 |
return 0; |
398 |
} |
399 |
|
400 |
int |
401 |
command_dumpfriendlyobjects (object *op, char *params) |
402 |
{ |
403 |
dump_friendly_objects (); |
404 |
return 0; |
405 |
} |
406 |
|
407 |
int |
408 |
command_printlos (object *op, char *params) |
409 |
{ |
410 |
if (op) |
411 |
print_los (op); |
412 |
return 0; |
413 |
} |
414 |
|
415 |
|
416 |
int |
417 |
command_version (object *op, char *params) |
418 |
{ |
419 |
version (op); |
420 |
return 0; |
421 |
} |
422 |
|
423 |
#ifndef BUG_LOG |
424 |
# define BUG_LOG "bug_log" |
425 |
#endif |
426 |
void |
427 |
bug_report (const char *reportstring) |
428 |
{ |
429 |
FILE *fp; |
430 |
|
431 |
if ((fp = fopen (BUG_LOG, "a")) != NULL) |
432 |
{ |
433 |
fprintf (fp, "%s\n", reportstring); |
434 |
fclose (fp); |
435 |
} |
436 |
else |
437 |
{ |
438 |
LOG (llevError, "Cannot write bugs file %s: %s\n", BUG_LOG, strerror (errno)); |
439 |
} |
440 |
} |
441 |
|
442 |
int |
443 |
command_output_sync (object *op, char *params) |
444 |
{ |
445 |
int val; |
446 |
|
447 |
if (!params) |
448 |
{ |
449 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Output sync time is presently %d", op->contr->outputs_sync); |
450 |
return 1; |
451 |
} |
452 |
val = atoi (params); |
453 |
if (val > 0) |
454 |
{ |
455 |
op->contr->outputs_sync = val; |
456 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Output sync time now set to %d", op->contr->outputs_sync); |
457 |
} |
458 |
else |
459 |
new_draw_info (NDI_UNIQUE, 0, op, "Invalid value for output_sync."); |
460 |
|
461 |
return 1; |
462 |
} |
463 |
|
464 |
int |
465 |
command_output_count (object *op, char *params) |
466 |
{ |
467 |
int val; |
468 |
|
469 |
if (!params) |
470 |
{ |
471 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Output count is presently %d", op->contr->outputs_count); |
472 |
return 1; |
473 |
} |
474 |
val = atoi (params); |
475 |
if (val > 0) |
476 |
{ |
477 |
op->contr->outputs_count = val; |
478 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Output count now set to %d", op->contr->outputs_count); |
479 |
} |
480 |
else |
481 |
new_draw_info (NDI_UNIQUE, 0, op, "Invalid value for output_count."); |
482 |
|
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; |
499 |
} |
500 |
|
501 |
/* 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 - |
503 |
* rather, we are making it convenient to find the values. params have |
504 |
* no meaning here. |
505 |
*/ |
506 |
int |
507 |
command_statistics (object *pl, char *params) |
508 |
{ |
509 |
if (!pl->contr) |
510 |
return 1; |
511 |
new_draw_info_format (NDI_UNIQUE, 0, pl, " Experience: %" PRId64, pl->stats.exp); |
512 |
new_draw_info_format (NDI_UNIQUE, 0, pl, " Next Level: %" PRId64, level_exp (pl->level + 1, pl->expmul)); |
513 |
new_draw_info (NDI_UNIQUE, 0, pl, "\nStat Nat/Real/Max"); |
514 |
|
515 |
new_draw_info_format (NDI_UNIQUE, 0, pl, "Str %2d/ %3d/%3d", |
516 |
pl->contr->orig_stats.Str, pl->stats.Str, 20 + pl->arch->clone.stats.Str); |
517 |
new_draw_info_format (NDI_UNIQUE, 0, pl, "Dex %2d/ %3d/%3d", |
518 |
pl->contr->orig_stats.Dex, pl->stats.Dex, 20 + pl->arch->clone.stats.Dex); |
519 |
new_draw_info_format (NDI_UNIQUE, 0, pl, "Con %2d/ %3d/%3d", |
520 |
pl->contr->orig_stats.Con, pl->stats.Con, 20 + pl->arch->clone.stats.Con); |
521 |
new_draw_info_format (NDI_UNIQUE, 0, pl, "Int %2d/ %3d/%3d", |
522 |
pl->contr->orig_stats.Int, pl->stats.Int, 20 + pl->arch->clone.stats.Int); |
523 |
new_draw_info_format (NDI_UNIQUE, 0, pl, "Wis %2d/ %3d/%3d", |
524 |
pl->contr->orig_stats.Wis, pl->stats.Wis, 20 + pl->arch->clone.stats.Wis); |
525 |
new_draw_info_format (NDI_UNIQUE, 0, pl, "Pow %2d/ %3d/%3d", |
526 |
pl->contr->orig_stats.Pow, pl->stats.Pow, 20 + pl->arch->clone.stats.Pow); |
527 |
new_draw_info_format (NDI_UNIQUE, 0, pl, "Cha %2d/ %3d/%3d", |
528 |
pl->contr->orig_stats.Cha, pl->stats.Cha, 20 + pl->arch->clone.stats.Cha); |
529 |
new_draw_info_format (NDI_UNIQUE, 0, pl, "\nAttack Mode: %s", pl->contr->peaceful ? "Peaceful" : "Hostile"); |
530 |
|
531 |
/* Can't think of anything else to print right now */ |
532 |
return 0; |
533 |
} |
534 |
|
535 |
int |
536 |
command_fix_me (object *op, char *params) |
537 |
{ |
538 |
sum_weight (op); |
539 |
op->update_stats (); |
540 |
return 1; |
541 |
} |
542 |
|
543 |
int |
544 |
command_logs (object *op, char *params) |
545 |
{ |
546 |
new_draw_info (NDI_UNIQUE, 0, op, "Nobody is currently logging kills."); |
547 |
|
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; |
578 |
} |
579 |
|
580 |
int |
581 |
command_bowmode (object *op, char *params) |
582 |
{ |
583 |
bowtype_t oldtype = op->contr->bowtype; |
584 |
static const char *const types[] = { "normal", "threewide", "spreadshot", "firenorth", |
585 |
"firene", "fireeast", "firese", "firesouth", |
586 |
"firesw", "firewest", "firenw", "bestarrow" |
587 |
}; |
588 |
char buf[MAX_BUF]; |
589 |
int i, found; |
590 |
|
591 |
if (!params) |
592 |
{ |
593 |
new_draw_info_format (NDI_UNIQUE, 0, op, "bowmode is set to %s", types[op->contr->bowtype]); |
594 |
return 1; |
595 |
} |
596 |
|
597 |
for (i = 0, found = 0; i <= bow_bestarrow; i++) |
598 |
{ |
599 |
if (!strcmp (params, types[i])) |
600 |
{ |
601 |
found++; |
602 |
op->contr->bowtype = (bowtype_t) i; |
603 |
break; |
604 |
} |
605 |
} |
606 |
|
607 |
if (!found) |
608 |
{ |
609 |
sprintf (buf, "bowmode: Unknown options %s, valid options are:", params); |
610 |
for (i = 0; i <= bow_bestarrow; i++) |
611 |
{ |
612 |
strcat (buf, " "); |
613 |
strcat (buf, types[i]); |
614 |
if (i < bow_nw) |
615 |
strcat (buf, ","); |
616 |
else |
617 |
strcat (buf, "."); |
618 |
} |
619 |
new_draw_info_format (NDI_UNIQUE, 0, op, buf); |
620 |
return 0; |
621 |
} |
622 |
|
623 |
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; |
655 |
} |
656 |
|
657 |
int |
658 |
command_showpets (object *op, char *params) |
659 |
{ |
660 |
objectlink *obl, *next; |
661 |
int counter = 0, target = 0; |
662 |
int have_shown_pet = 0; |
663 |
|
664 |
if (params != NULL) |
665 |
target = atoi (params); |
666 |
for (obl = first_friendly_object; obl != NULL; obl = next) |
667 |
{ |
668 |
object *ob = obl->ob; |
669 |
|
670 |
next = obl->next; |
671 |
if (ob->owner == op) |
672 |
{ |
673 |
if (target == 0) |
674 |
{ |
675 |
if (counter == 0) |
676 |
new_draw_info (NDI_UNIQUE, 0, op, "Pets:"); |
677 |
new_draw_info_format (NDI_UNIQUE, 0, op, "%d %s - level %d", ++counter, &ob->name, ob->level); |
678 |
} |
679 |
else if (!have_shown_pet && ++counter == target) |
680 |
{ |
681 |
new_draw_info_format (NDI_UNIQUE, 0, op, "level %d %s", ob->level, &ob->name); |
682 |
new_draw_info_format (NDI_UNIQUE, 0, op, "%d/%d HP, %d/%d SP", ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp); |
683 |
/* this is not a nice way to do this, it should be made to be more like the statistics command */ |
684 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Str %d", ob->stats.Str); |
685 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Dex %d", ob->stats.Dex); |
686 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Con %d", ob->stats.Con); |
687 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Int %d", ob->stats.Int); |
688 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Wis %d", ob->stats.Wis); |
689 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Cha %d", ob->stats.Cha); |
690 |
new_draw_info_format (NDI_UNIQUE, 0, op, "Pow %d", ob->stats.Pow); |
691 |
new_draw_info_format (NDI_UNIQUE, 0, op, "wc %d damage %d ac %d ", ob->stats.wc, ob->stats.dam, ob->stats.ac); |
692 |
have_shown_pet = 1; |
693 |
} |
694 |
} |
695 |
} |
696 |
if (counter == 0) |
697 |
new_draw_info (NDI_UNIQUE, 0, op, "you have no pets."); |
698 |
else if (target != 0 && have_shown_pet == 0) |
699 |
new_draw_info (NDI_UNIQUE, 0, op, "no such pet."); |
700 |
return 0; |
701 |
} |
702 |
|
703 |
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) |
732 |
{ |
733 |
int i; |
734 |
|
735 |
if (!op) |
736 |
return 0; |
737 |
|
738 |
for (i = 0; i < NROFATTACKS; i++) |
739 |
{ |
740 |
if (i == ATNR_INTERNAL) |
741 |
continue; |
742 |
|
743 |
new_draw_info_format (NDI_UNIQUE, 0, op, "%-20s %+5d", attacktype_desc[i], op->resist[i]); |
744 |
} |
745 |
|
746 |
/* If dragon player, let's display natural resistances */ |
747 |
if (is_dragon_pl (op)) |
748 |
{ |
749 |
int attack; |
750 |
object *tmp; |
751 |
|
752 |
for (tmp = op->inv; tmp != NULL; tmp = tmp->below) |
753 |
{ |
754 |
if ((tmp->type == FORCE) && (strcmp (tmp->arch->name, "dragon_skin_force") == 0)) |
755 |
{ |
756 |
new_draw_info (NDI_UNIQUE, 0, op, "\nNatural skin resistances:"); |
757 |
for (attack = 0; attack < NROFATTACKS; attack++) |
758 |
{ |
759 |
if (atnr_is_dragon_enabled (attack)) |
760 |
{ |
761 |
new_draw_info_format (NDI_UNIQUE, 0, op, "%s: %d", change_resist_msg[attack], tmp->resist[attack]); |
762 |
} |
763 |
} |
764 |
break; |
765 |
} |
766 |
} |
767 |
} |
768 |
|
769 |
return 0; |
770 |
} |
771 |
|
772 |
/* |
773 |
* Actual commands. |
774 |
* Those should be in small separate files (c_object.c, c_wiz.c, cmove.c,...) |
775 |
*/ |
776 |
|
777 |
|
778 |
static void |
779 |
help_topics (object *op, int what) |
780 |
{ |
781 |
DIR *dirp; |
782 |
struct dirent *de; |
783 |
char filename[MAX_BUF], line[80]; |
784 |
int namelen, linelen = 0; |
785 |
|
786 |
switch (what) |
787 |
{ |
788 |
case 1: |
789 |
sprintf (filename, "%s/wizhelp", settings.datadir); |
790 |
new_draw_info (NDI_UNIQUE, 0, op, " Wiz commands:"); |
791 |
break; |
792 |
case 3: |
793 |
sprintf (filename, "%s/mischelp", settings.datadir); |
794 |
new_draw_info (NDI_UNIQUE, 0, op, " Misc help:"); |
795 |
break; |
796 |
default: |
797 |
sprintf (filename, "%s/help", settings.datadir); |
798 |
new_draw_info (NDI_UNIQUE, 0, op, " Commands:"); |
799 |
break; |
800 |
} |
801 |
|
802 |
if (!(dirp = opendir (filename))) |
803 |
return; |
804 |
|
805 |
line[0] = '\0'; |
806 |
while (de = readdir (dirp)) |
807 |
{ |
808 |
namelen = strlen (de->d_name); |
809 |
if (namelen <= 2 && *de->d_name == '.' && (namelen == 1 || de->d_name[1] == '.')) |
810 |
continue; |
811 |
linelen += namelen + 1; |
812 |
if (linelen > 42) |
813 |
{ |
814 |
new_draw_info (NDI_UNIQUE, 0, op, line); |
815 |
sprintf (line, " %s", de->d_name); |
816 |
linelen = namelen + 1; |
817 |
continue; |
818 |
} |
819 |
strcat (line, " "); |
820 |
strcat (line, de->d_name); |
821 |
} |
822 |
new_draw_info (NDI_UNIQUE, 0, op, line); |
823 |
closedir (dirp); |
824 |
} |
825 |
|
826 |
static void |
827 |
show_commands (object *op, int what) |
828 |
{ |
829 |
char line[80]; |
830 |
int i, size, namelen, linelen = 0; |
831 |
CommArray_s *ap; |
832 |
extern CommArray_s Commands[], WizCommands[]; |
833 |
extern const int CommandsSize, WizCommandsSize; |
834 |
|
835 |
switch (what) |
836 |
{ |
837 |
case 1: |
838 |
ap = WizCommands; |
839 |
size = WizCommandsSize; |
840 |
new_draw_info (NDI_UNIQUE, 0, op, " Wiz commands:"); |
841 |
break; |
842 |
case 2: |
843 |
ap = CommunicationCommands; |
844 |
size = CommunicationCommandSize; |
845 |
new_draw_info (NDI_UNIQUE, 0, op, " Communication commands:"); |
846 |
break; |
847 |
default: |
848 |
ap = Commands; |
849 |
size = CommandsSize; |
850 |
new_draw_info (NDI_UNIQUE, 0, op, " Commands:"); |
851 |
break; |
852 |
} |
853 |
|
854 |
line[0] = '\0'; |
855 |
for (i = 0; i < size; i++) |
856 |
{ |
857 |
namelen = strlen (ap[i].name); |
858 |
linelen += namelen + 1; |
859 |
if (linelen > 42) |
860 |
{ |
861 |
new_draw_info (NDI_UNIQUE, 0, op, line); |
862 |
sprintf (line, " %s", ap[i].name); |
863 |
linelen = namelen + 1; |
864 |
continue; |
865 |
} |
866 |
strcat (line, " "); |
867 |
strcat (line, ap[i].name); |
868 |
} |
869 |
new_draw_info (NDI_UNIQUE, 0, op, line); |
870 |
} |
871 |
|
872 |
|
873 |
int |
874 |
command_help (object *op, char *params) |
875 |
{ |
876 |
struct stat st; |
877 |
FILE *fp; |
878 |
char filename[MAX_BUF], line[MAX_BUF]; |
879 |
int len; |
880 |
|
881 |
if (op != NULL) |
882 |
clear_win_info (op); |
883 |
|
884 |
/* |
885 |
* Main help page? |
886 |
*/ |
887 |
if (!params) |
888 |
{ |
889 |
sprintf (filename, "%s/def_help", settings.datadir); |
890 |
if ((fp = fopen (filename, "r")) == NULL) |
891 |
{ |
892 |
LOG (llevError, "Cannot open help file %s: %s\n", filename, strerror (errno)); |
893 |
return 0; |
894 |
} |
895 |
while (fgets (line, MAX_BUF, fp)) |
896 |
{ |
897 |
line[MAX_BUF - 1] = '\0'; |
898 |
len = strlen (line) - 1; |
899 |
if (line[len] == '\n') |
900 |
line[len] = '\0'; |
901 |
new_draw_info (NDI_UNIQUE, 0, op, line); |
902 |
} |
903 |
fclose (fp); |
904 |
return 0; |
905 |
} |
906 |
|
907 |
/* |
908 |
* Topics list |
909 |
*/ |
910 |
if (!strcmp (params, "topics")) |
911 |
{ |
912 |
help_topics (op, 3); |
913 |
help_topics (op, 0); |
914 |
if (QUERY_FLAG (op, FLAG_WIZ)) |
915 |
help_topics (op, 1); |
916 |
return 0; |
917 |
} |
918 |
|
919 |
/* |
920 |
* Commands list |
921 |
*/ |
922 |
if (!strcmp (params, "commands")) |
923 |
{ |
924 |
show_commands (op, 0); |
925 |
show_commands (op, 2); /* show comm commands */ |
926 |
if (QUERY_FLAG (op, FLAG_WIZ)) |
927 |
show_commands (op, 1); |
928 |
return 0; |
929 |
} |
930 |
|
931 |
/* |
932 |
* User wants info about command |
933 |
*/ |
934 |
if (strchr (params, '.') || strchr (params, ' ') || strchr (params, '/')) |
935 |
{ |
936 |
sprintf (line, "Illegal characters in '%s'", params); |
937 |
new_draw_info (NDI_UNIQUE, 0, op, line); |
938 |
return 0; |
939 |
} |
940 |
|
941 |
sprintf (filename, "%s/mischelp/%s", settings.datadir, params); |
942 |
if (stat (filename, &st) || !S_ISREG (st.st_mode)) |
943 |
{ |
944 |
if (op) |
945 |
{ |
946 |
sprintf (filename, "%s/help/%s", settings.datadir, params); |
947 |
if (stat (filename, &st) || !S_ISREG (st.st_mode)) |
948 |
{ |
949 |
if (QUERY_FLAG (op, FLAG_WIZ)) |
950 |
{ |
951 |
sprintf (filename, "%s/wizhelp/%s", settings.datadir, params); |
952 |
if (stat (filename, &st) || !S_ISREG (st.st_mode)) |
953 |
goto nohelp; |
954 |
} |
955 |
else |
956 |
goto nohelp; |
957 |
} |
958 |
} |
959 |
} |
960 |
|
961 |
/* |
962 |
* Found that. Just cat it to screen. |
963 |
*/ |
964 |
if ((fp = fopen (filename, "r")) == NULL) |
965 |
{ |
966 |
LOG (llevError, "Cannot open help file %s: %s\n", filename, strerror (errno)); |
967 |
return 0; |
968 |
} |
969 |
sprintf (line, "Help about '%s'", params); |
970 |
new_draw_info (NDI_UNIQUE, 0, op, line); |
971 |
while (fgets (line, MAX_BUF, fp)) |
972 |
{ |
973 |
line[MAX_BUF - 1] = '\0'; |
974 |
len = strlen (line) - 1; |
975 |
if (line[len] == '\n') |
976 |
line[len] = '\0'; |
977 |
new_draw_info (NDI_UNIQUE, 0, op, line); |
978 |
} |
979 |
fclose (fp); |
980 |
return 0; |
981 |
|
982 |
/* |
983 |
* No_help -escape |
984 |
*/ |
985 |
nohelp: |
986 |
sprintf (line, "No help available on '%s'", params); |
987 |
new_draw_info (NDI_UNIQUE, 0, op, line); |
988 |
return 0; |
989 |
} |
990 |
|
991 |
|
992 |
int |
993 |
onoff_value (const char *line) |
994 |
{ |
995 |
int i; |
996 |
|
997 |
if (sscanf (line, "%d", &i)) |
998 |
return (i != 0); |
999 |
switch (line[0]) |
1000 |
{ |
1001 |
case 'o': |
1002 |
switch (line[1]) |
1003 |
{ |
1004 |
case 'n': |
1005 |
return 1; /* on */ |
1006 |
default: |
1007 |
return 0; /* o[ff] */ |
1008 |
} |
1009 |
case 'y': /* y[es] */ |
1010 |
case 'k': /* k[ylla] */ |
1011 |
case 's': |
1012 |
case 'd': |
1013 |
return 1; |
1014 |
case 'n': /* n[o] */ |
1015 |
case 'e': /* e[i] */ |
1016 |
case 'u': |
1017 |
default: |
1018 |
return 0; |
1019 |
} |
1020 |
} |
1021 |
|
1022 |
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) |
1041 |
{ |
1042 |
char buf[MAX_BUF]; |
1043 |
|
1044 |
if (settings.set_title == FALSE) |
1045 |
{ |
1046 |
new_draw_info (NDI_UNIQUE, 0, op, "You cannot change your title."); |
1047 |
return 1; |
1048 |
} |
1049 |
|
1050 |
/* dragon players cannot change titles */ |
1051 |
if (is_dragon_pl (op)) |
1052 |
{ |
1053 |
new_draw_info (NDI_UNIQUE, 0, op, "Dragons cannot change titles."); |
1054 |
return 1; |
1055 |
} |
1056 |
|
1057 |
if (params == NULL) |
1058 |
{ |
1059 |
if (op->contr->own_title[0] == '\0') |
1060 |
sprintf (buf, "Your title is '%s'.", op->contr->title); |
1061 |
else |
1062 |
sprintf (buf, "Your title is '%s'.", op->contr->own_title); |
1063 |
new_draw_info (NDI_UNIQUE, 0, op, buf); |
1064 |
return 1; |
1065 |
} |
1066 |
if (strcmp (params, "clear") == 0 || strcmp (params, "default") == 0) |
1067 |
{ |
1068 |
if (op->contr->own_title[0] == '\0') |
1069 |
new_draw_info (NDI_UNIQUE, 0, op, "Your title is the default title."); |
1070 |
else |
1071 |
new_draw_info (NDI_UNIQUE, 0, op, "Title set to default."); |
1072 |
op->contr->own_title[0] = '\0'; |
1073 |
return 1; |
1074 |
} |
1075 |
|
1076 |
if ((int) strlen (params) >= MAX_NAME) |
1077 |
{ |
1078 |
new_draw_info (NDI_UNIQUE, 0, op, "Title too long."); |
1079 |
return 1; |
1080 |
} |
1081 |
strcpy (op->contr->own_title, params); |
1082 |
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 |
} |
1136 |
|
1137 |
int |
1138 |
command_kill_pets (object *op, char *params) |
1139 |
{ |
1140 |
objectlink *obl, *next; |
1141 |
int counter = 0, removecount = 0; |
1142 |
|
1143 |
if (params == NULL) |
1144 |
{ |
1145 |
terminate_all_pets (op); |
1146 |
new_draw_info (NDI_UNIQUE, 0, op, "Your pets have been killed."); |
1147 |
} |
1148 |
else |
1149 |
{ |
1150 |
int target = atoi (params); |
1151 |
|
1152 |
for (obl = first_friendly_object; obl != NULL; obl = next) |
1153 |
{ |
1154 |
object *ob = obl->ob; |
1155 |
|
1156 |
next = obl->next; |
1157 |
if (ob->owner == op) |
1158 |
if (++counter == target || (target == 0 && !strcasecmp (ob->name, params))) |
1159 |
{ |
1160 |
ob->destroy (); |
1161 |
removecount++; |
1162 |
} |
1163 |
} |
1164 |
if (removecount != 0) |
1165 |
new_draw_info_format (NDI_UNIQUE, 0, op, "killed %d pets.\n", removecount); |
1166 |
else |
1167 |
new_draw_info (NDI_UNIQUE, 0, op, "Couldn't find any suitable pets to kill.\n"); |
1168 |
} |
1169 |
return 0; |
1170 |
} |