1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
356 | { |
356 | { |
357 | new_draw_info_format (NDI_UNIQUE, 0, op, "No such god %s.", str); |
357 | new_draw_info_format (NDI_UNIQUE, 0, op, "No such god %s.", str); |
358 | return 1; |
358 | return 1; |
359 | } |
359 | } |
360 | |
360 | |
361 | become_follower (ob, god); |
361 | ob->become_follower (god); |
362 | return 1; |
362 | return 1; |
363 | } |
363 | } |
364 | |
364 | |
365 | int |
365 | int |
366 | command_freeze (object *op, char *params) |
366 | command_freeze (object *op, char *params) |
… | |
… | |
436 | |
436 | |
437 | int |
437 | int |
438 | command_summon (object *op, char *params) |
438 | command_summon (object *op, char *params) |
439 | { |
439 | { |
440 | int i; |
440 | int i; |
441 | object *dummy; |
|
|
442 | player *pl; |
441 | player *pl; |
443 | |
442 | |
444 | if (!op) |
443 | if (!op) |
445 | return 0; |
444 | return 0; |
446 | |
445 | |
… | |
… | |
452 | |
451 | |
453 | pl = get_other_player_from_name (op, params); |
452 | pl = get_other_player_from_name (op, params); |
454 | if (!pl) |
453 | if (!pl) |
455 | return 1; |
454 | return 1; |
456 | |
455 | |
457 | i = find_free_spot (op, op->map, op->x, op->y, 1, 9); |
456 | maptile *m = op->map; |
|
|
457 | sint16 nx = op->x; |
|
|
458 | sint16 ny = op->y; |
|
|
459 | |
|
|
460 | i = find_free_spot (op, m, nx, ny, 1, SIZEOFFREE1+1); |
458 | if (i == -1) |
461 | if (i == -1) |
459 | { |
462 | { |
460 | new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); |
463 | new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); |
461 | return 1; |
464 | return 1; |
462 | } |
465 | } |
463 | |
466 | |
464 | pl->ob->player_goto (op->map->path, op->x + freearr_x[i], op->y + freearr_y[i]); |
467 | nx += freearr_x [i]; |
|
|
468 | ny += freearr_y [i]; |
|
|
469 | |
|
|
470 | if (!xy_normalise (m, nx, ny)) |
|
|
471 | { |
|
|
472 | new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); |
|
|
473 | return 1; |
|
|
474 | } |
|
|
475 | |
|
|
476 | pl->ob->player_goto (m->path, nx, ny); |
465 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); |
477 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); |
466 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
478 | new_draw_info (NDI_UNIQUE, 0, op, "OK."); |
467 | |
479 | |
468 | return 1; |
480 | return 1; |
469 | } |
481 | } |
… | |
… | |
486 | int |
498 | int |
487 | command_create (object *op, char *params) |
499 | command_create (object *op, char *params) |
488 | { |
500 | { |
489 | object *tmp = NULL; |
501 | object *tmp = NULL; |
490 | int nrof, i, magic, set_magic = 0, set_nrof = 0, gotquote, gotspace; |
502 | int nrof, i, magic, set_magic = 0, set_nrof = 0, gotquote, gotspace; |
491 | char buf[MAX_BUF], *cp, *bp = buf, *bp2, *bp3, *bp4, *endline; |
503 | char buf[MAX_BUF], *cp, *bp = buf, *bp2, *bp3, *endline; |
492 | archetype *at, *at_spell = NULL; |
504 | archetype *at, *at_spell = NULL; |
493 | artifact *art = NULL; |
505 | artifact *art = NULL; |
494 | |
506 | |
495 | if (!op) |
507 | if (!op) |
496 | return 0; |
508 | return 0; |
… | |
… | |
629 | set_abs_magic (tmp, magic); |
641 | set_abs_magic (tmp, magic); |
630 | |
642 | |
631 | if (art) |
643 | if (art) |
632 | give_artifact_abilities (tmp, art->item); |
644 | give_artifact_abilities (tmp, art->item); |
633 | |
645 | |
634 | if (need_identify (tmp)) |
646 | if (tmp->need_identify ()) |
635 | { |
647 | { |
636 | tmp->set_flag (FLAG_IDENTIFIED); |
648 | tmp->set_flag (FLAG_IDENTIFIED); |
637 | tmp->clr_flag (FLAG_KNOWN_MAGICAL); |
649 | tmp->clr_flag (FLAG_KNOWN_MAGICAL); |
638 | } |
650 | } |
639 | |
651 | |
… | |
… | |
644 | * is we want to find two spaces, but if we got a quote, |
656 | * is we want to find two spaces, but if we got a quote, |
645 | * any spaces there don't count. |
657 | * any spaces there don't count. |
646 | */ |
658 | */ |
647 | while (*bp2 && bp2 <= endline) |
659 | while (*bp2 && bp2 <= endline) |
648 | { |
660 | { |
649 | bp4 = NULL; |
|
|
650 | gotspace = 0; |
661 | gotspace = 0; |
651 | gotquote = 0; |
662 | gotquote = 0; |
652 | |
663 | |
653 | /* find the first quote */ |
664 | /* find the first quote */ |
654 | for (bp3 = bp2; *bp3 && gotspace < 2 && gotquote < 2; bp3++) |
665 | for (bp3 = bp2; *bp3 && gotspace < 2 && gotquote < 2; bp3++) |