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 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,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 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. |
… | |
… | |
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 <loader.h> |
|
|
27 | #include <sproto.h> |
26 | #include <sproto.h> |
28 | |
27 | |
29 | /* Handles misc. input request - things like hash table, malloc, maps, etc */ |
28 | /* Handles misc. input request - things like hash table, malloc, maps, etc */ |
30 | |
|
|
31 | typedef struct |
|
|
32 | { |
|
|
33 | char namebuf[MAX_BUF]; |
|
|
34 | int login_order; |
|
|
35 | } chars_names; |
|
|
36 | |
29 | |
37 | int |
30 | int |
38 | command_time (object *op, char *params) |
31 | command_time (object *op, char *params) |
39 | { |
32 | { |
40 | print_tod (op); |
33 | print_tod (op); |
… | |
… | |
209 | " Wis %2d\n" |
202 | " Wis %2d\n" |
210 | " Cha %2d\n" |
203 | " Cha %2d\n" |
211 | " Pow %2d\n" |
204 | " Pow %2d\n" |
212 | " wc %d damage %d ac %d\n", |
205 | " wc %d damage %d ac %d\n", |
213 | &ob->name, |
206 | &ob->name, |
214 | &ob->name, |
207 | ob->level, |
215 | ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp, |
208 | ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp, |
216 | ob->stats.Str, |
209 | ob->stats.Str, |
217 | ob->stats.Dex, |
210 | ob->stats.Dex, |
218 | ob->stats.Con, |
211 | ob->stats.Con, |
219 | ob->stats.Int, |
212 | ob->stats.Int, |
… | |
… | |
247 | for (int i = 0; i < NROFATTACKS; i++) |
240 | for (int i = 0; i < NROFATTACKS; i++) |
248 | if (i != ATNR_INTERNAL) |
241 | if (i != ATNR_INTERNAL) |
249 | msg.printf (" %-20s %+4d\n", attacktype_desc [i], op->resist [i]); |
242 | msg.printf (" %-20s %+4d\n", attacktype_desc [i], op->resist [i]); |
250 | |
243 | |
251 | /* If dragon player, let's display natural resistances */ |
244 | /* If dragon player, let's display natural resistances */ |
252 | if (is_dragon_pl (op)) |
245 | if (op->is_dragon ()) |
253 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
246 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
254 | if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force) |
247 | if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force) |
255 | { |
248 | { |
256 | msg << "\nOf those, these are natural skin resistances:\n\n"; |
249 | msg << "\nOf those, these are natural skin resistances:\n\n"; |
257 | |
250 | |
… | |
… | |
265 | op->contr->infobox (MSG_CHANNEL ("resistances"), msg); |
258 | op->contr->infobox (MSG_CHANNEL ("resistances"), msg); |
266 | |
259 | |
267 | return 0; |
260 | return 0; |
268 | } |
261 | } |
269 | |
262 | |
270 | /* |
|
|
271 | * Actual commands. |
|
|
272 | * Those should be in small separate files (c_object.c, c_wiz.c, cmove.c,...) |
|
|
273 | */ |
|
|
274 | |
|
|
275 | int |
|
|
276 | onoff_value (const char *line) |
|
|
277 | { |
|
|
278 | int i; |
|
|
279 | |
|
|
280 | if (sscanf (line, "%d", &i)) |
|
|
281 | return (i != 0); |
|
|
282 | switch (line[0]) |
|
|
283 | { |
|
|
284 | case 'o': |
|
|
285 | switch (line[1]) |
|
|
286 | { |
|
|
287 | case 'n': |
|
|
288 | return 1; /* on */ |
|
|
289 | default: |
|
|
290 | return 0; /* o[ff] */ |
|
|
291 | } |
|
|
292 | case 'y': /* y[es] */ |
|
|
293 | case 'k': /* k[ylla] */ |
|
|
294 | case 's': |
|
|
295 | case 'd': |
|
|
296 | return 1; |
|
|
297 | case 'n': /* n[o] */ |
|
|
298 | case 'e': /* e[i] */ |
|
|
299 | case 'u': |
|
|
300 | default: |
|
|
301 | return 0; |
|
|
302 | } |
|
|
303 | } |
|
|
304 | |
|
|
305 | int |
263 | int |
306 | command_title (object *op, char *params) |
264 | command_title (object *op, char *params) |
307 | { |
265 | { |
308 | char buf[MAX_BUF]; |
266 | char buf[MAX_BUF]; |
309 | |
267 | |
… | |
… | |
312 | new_draw_info (NDI_UNIQUE, 0, op, "You cannot change your title."); |
270 | new_draw_info (NDI_UNIQUE, 0, op, "You cannot change your title."); |
313 | return 1; |
271 | return 1; |
314 | } |
272 | } |
315 | |
273 | |
316 | /* dragon players cannot change titles */ |
274 | /* dragon players cannot change titles */ |
317 | if (is_dragon_pl (op)) |
275 | if (op->is_dragon ()) |
318 | { |
276 | { |
319 | new_draw_info (NDI_UNIQUE, 0, op, "Dragons cannot change titles."); |
277 | new_draw_info (NDI_UNIQUE, 0, op, "Dragons cannot change titles."); |
320 | return 1; |
278 | return 1; |
321 | } |
279 | } |
322 | |
280 | |