1 |
elmex |
1.1 |
/* |
2 |
pippijn |
1.10 |
* 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 |
elmex |
1.1 |
|
25 |
|
|
#include <global.h> |
26 |
|
|
#include <loader.h> |
27 |
|
|
#include <sproto.h> |
28 |
|
|
|
29 |
root |
1.5 |
int |
30 |
|
|
command_me (object *op, char *params) |
31 |
elmex |
1.1 |
{ |
32 |
root |
1.5 |
char buf[MAX_BUF]; |
33 |
elmex |
1.1 |
|
34 |
root |
1.5 |
if (!params) |
35 |
|
|
return 0; |
36 |
|
|
snprintf (buf, MAX_BUF - 1, "%s %s", &op->name, params); |
37 |
|
|
new_info_map (NDI_UNIQUE | NDI_BLUE, op->map, buf); |
38 |
elmex |
1.1 |
|
39 |
root |
1.5 |
return 0; |
40 |
elmex |
1.1 |
} |
41 |
|
|
|
42 |
|
|
|
43 |
root |
1.5 |
int |
44 |
|
|
command_cointoss (object *op, char *params) |
45 |
elmex |
1.1 |
{ |
46 |
root |
1.5 |
char buf[MAX_BUF]; |
47 |
|
|
char buf2[MAX_BUF]; |
48 |
|
|
int i; |
49 |
|
|
|
50 |
|
|
i = rndm (1, 2); |
51 |
|
|
if (i == 1) |
52 |
|
|
{ |
53 |
|
|
snprintf (buf, MAX_BUF - 1, "%s flips a coin.... Heads!", &op->name); |
54 |
|
|
snprintf (buf2, MAX_BUF - 1, "You flip a coin.... Heads!"); |
55 |
|
|
} |
56 |
|
|
else |
57 |
|
|
{ |
58 |
|
|
snprintf (buf, MAX_BUF - 1, "%s flips a coin.... Tails!", &op->name); |
59 |
|
|
snprintf (buf2, MAX_BUF - 1, "You flip a coin.... Tails!"); |
60 |
elmex |
1.1 |
} |
61 |
root |
1.5 |
new_draw_info (NDI_UNIQUE, 0, op, buf2); |
62 |
|
|
new_info_map_except (NDI_WHITE, op->map, op, buf); |
63 |
|
|
return 0; |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
static const char *const orcknuckle[7] = { "none", "beholder", "ghost", "knight", |
67 |
|
|
"princess", "dragon", "orc" |
68 |
|
|
}; |
69 |
|
|
|
70 |
|
|
int |
71 |
|
|
command_orcknuckle (object *op, char *params) |
72 |
|
|
{ |
73 |
|
|
char buf[MAX_BUF]; |
74 |
|
|
char buf2[MAX_BUF]; |
75 |
|
|
int i, j, k, l; |
76 |
|
|
|
77 |
|
|
i = rndm (1, 5); |
78 |
|
|
j = rndm (1, 5); |
79 |
|
|
k = rndm (1, 5); |
80 |
|
|
l = rndm (1, 6); |
81 |
|
|
|
82 |
|
|
snprintf (buf2, MAX_BUF - 1, "%s rolls %s, %s, %s, %s!", &op->name, orcknuckle[i], orcknuckle[j], orcknuckle[k], orcknuckle[l]); |
83 |
|
|
snprintf (buf, MAX_BUF - 1, "You roll %s, %s, %s, %s!", orcknuckle[i], orcknuckle[j], orcknuckle[k], orcknuckle[l]); |
84 |
|
|
new_draw_info (NDI_UNIQUE, 0, op, buf); |
85 |
|
|
new_info_map_except (NDI_UNIQUE, op->map, op, buf2); |
86 |
|
|
return 0; |
87 |
elmex |
1.1 |
} |