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,2011,2012 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 |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the Affero GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * and the GNU General Public License along with this program. If not, see |
19 | * and the GNU General Public License along with this program. If not, see |
20 | * <http://www.gnu.org/licenses/>. |
20 | * <http://www.gnu.org/licenses/>. |
21 | * |
21 | * |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <sproto.h> |
26 | #include <sproto.h> |
… | |
… | |
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 | |
… | |
… | |
499 | int |
498 | int |
500 | command_create (object *op, char *params) |
499 | command_create (object *op, char *params) |
501 | { |
500 | { |
502 | object *tmp = NULL; |
501 | object *tmp = NULL; |
503 | 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; |
504 | char buf[MAX_BUF], *cp, *bp = buf, *bp2, *bp3, *bp4, *endline; |
503 | char buf[MAX_BUF], *cp, *bp = buf, *bp2, *bp3, *endline; |
505 | archetype *at, *at_spell = NULL; |
504 | archetype *at, *at_spell = NULL; |
506 | artifact *art = NULL; |
505 | artifact *art = NULL; |
507 | |
506 | |
508 | if (!op) |
507 | if (!op) |
509 | return 0; |
508 | return 0; |
… | |
… | |
657 | * 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, |
658 | * any spaces there don't count. |
657 | * any spaces there don't count. |
659 | */ |
658 | */ |
660 | while (*bp2 && bp2 <= endline) |
659 | while (*bp2 && bp2 <= endline) |
661 | { |
660 | { |
662 | bp4 = NULL; |
|
|
663 | gotspace = 0; |
661 | gotspace = 0; |
664 | gotquote = 0; |
662 | gotquote = 0; |
665 | |
663 | |
666 | /* find the first quote */ |
664 | /* find the first quote */ |
667 | for (bp3 = bp2; *bp3 && gotspace < 2 && gotquote < 2; bp3++) |
665 | for (bp3 = bp2; *bp3 && gotspace < 2 && gotquote < 2; bp3++) |
… | |
… | |
1035 | /**************************************************************************/ |
1033 | /**************************************************************************/ |
1036 | |
1034 | |
1037 | int |
1035 | int |
1038 | command_stats (object *op, char *params) |
1036 | command_stats (object *op, char *params) |
1039 | { |
1037 | { |
1040 | char thing[20]; |
|
|
1041 | char buf[MAX_BUF]; |
1038 | char buf[MAX_BUF]; |
1042 | |
1039 | |
1043 | thing[0] = '\0'; |
1040 | if (params == NULL || params[0] == '\0') |
1044 | if (params == NULL || !sscanf (params, "%s", thing) || thing == NULL) |
|
|
1045 | { |
1041 | { |
1046 | new_draw_info (NDI_UNIQUE, 0, op, "Who?"); |
1042 | new_draw_info (NDI_UNIQUE, 0, op, "Who?"); |
1047 | return 1; |
1043 | return 1; |
1048 | } |
1044 | } |
1049 | |
1045 | |
1050 | for_all_players (pl) |
1046 | for_all_players (pl) |
1051 | if (!strcmp (&pl->ob->name, thing)) |
1047 | if (!strcmp (&pl->ob->name, params)) |
1052 | { |
1048 | { |
1053 | sprintf (buf, "Str : %-2d H.P. : %-4d MAX : %d", pl->ob->stats.Str, pl->ob->stats.hp, pl->ob->stats.maxhp); |
1049 | sprintf (buf, "Str : %-2d H.P. : %-4d MAX : %d", pl->ob->stats.Str, pl->ob->stats.hp, pl->ob->stats.maxhp); |
1054 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1050 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1055 | sprintf (buf, "Dex : %-2d S.P. : %-4d MAX : %d", pl->ob->stats.Dex, pl->ob->stats.sp, pl->ob->stats.maxsp); |
1051 | sprintf (buf, "Dex : %-2d S.P. : %-4d MAX : %d", pl->ob->stats.Dex, pl->ob->stats.sp, pl->ob->stats.maxsp); |
1056 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
1052 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
… | |
… | |
1349 | { |
1345 | { |
1350 | new_draw_info (NDI_UNIQUE, 0, op, "Which spell do you want to forget?"); |
1346 | new_draw_info (NDI_UNIQUE, 0, op, "Which spell do you want to forget?"); |
1351 | return 0; |
1347 | return 0; |
1352 | } |
1348 | } |
1353 | |
1349 | |
1354 | spell = lookup_spell_by_name (op, params); |
1350 | spell = op->find_spell (params); |
1355 | if (spell == NULL) |
1351 | if (spell == NULL) |
1356 | { |
1352 | { |
1357 | new_draw_info_format (NDI_UNIQUE, 0, op, "You do not know the spell %s.", params); |
1353 | new_draw_info_format (NDI_UNIQUE, 0, op, "You do not know the spell %s.", params); |
1358 | return 0; |
1354 | return 0; |
1359 | } |
1355 | } |