ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_misc.C
(Generate patch)

Comparing deliantra/server/server/c_misc.C (file contents):
Revision 1.76 by root, Thu Oct 15 21:40:42 2009 UTC vs.
Revision 1.87 by root, Mon Oct 29 23:55:55 2012 UTC

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.
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 <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
31typedef struct
32{
33 char namebuf[MAX_BUF];
34 int login_order;
35} chars_names;
36 29
37int 30int
38command_time (object *op, char *params) 31command_time (object *op, char *params)
39{ 32{
40 print_tod (op); 33 print_tod (op);
58 51
59 sprintf (buf, "Set debug level to %d.", i); 52 sprintf (buf, "Set debug level to %d.", i);
60 new_draw_info (NDI_UNIQUE, 0, op, buf); 53 new_draw_info (NDI_UNIQUE, 0, op, buf);
61 return 1; 54 return 1;
62} 55}
63
64 56
65/* 57/*
66 * Those dumps should be just one dump with good parser 58 * Those dumps should be just one dump with good parser
67 */ 59 */
68 60
210 " Wis %2d\n" 202 " Wis %2d\n"
211 " Cha %2d\n" 203 " Cha %2d\n"
212 " Pow %2d\n" 204 " Pow %2d\n"
213 " wc %d damage %d ac %d\n", 205 " wc %d damage %d ac %d\n",
214 &ob->name, 206 &ob->name,
215 &ob->name, 207 ob->level,
216 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,
217 ob->stats.Str, 209 ob->stats.Str,
218 ob->stats.Dex, 210 ob->stats.Dex,
219 ob->stats.Con, 211 ob->stats.Con,
220 ob->stats.Int, 212 ob->stats.Int,
248 for (int i = 0; i < NROFATTACKS; i++) 240 for (int i = 0; i < NROFATTACKS; i++)
249 if (i != ATNR_INTERNAL) 241 if (i != ATNR_INTERNAL)
250 msg.printf (" %-20s %+4d\n", attacktype_desc [i], op->resist [i]); 242 msg.printf (" %-20s %+4d\n", attacktype_desc [i], op->resist [i]);
251 243
252 /* If dragon player, let's display natural resistances */ 244 /* If dragon player, let's display natural resistances */
253 if (is_dragon_pl (op)) 245 if (op->is_dragon ())
254 for (object *tmp = op->inv; tmp; tmp = tmp->below) 246 for (object *tmp = op->inv; tmp; tmp = tmp->below)
255 if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force) 247 if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force)
256 { 248 {
257 msg << "\nOf those, these are natural skin resistances:\n\n"; 249 msg << "\nOf those, these are natural skin resistances:\n\n";
258 250
266 op->contr->infobox (MSG_CHANNEL ("resistances"), msg); 258 op->contr->infobox (MSG_CHANNEL ("resistances"), msg);
267 259
268 return 0; 260 return 0;
269} 261}
270 262
271/*
272 * Actual commands.
273 * Those should be in small separate files (c_object.c, c_wiz.c, cmove.c,...)
274 */
275
276int
277onoff_value (const char *line)
278{
279 int i;
280
281 if (sscanf (line, "%d", &i))
282 return (i != 0);
283 switch (line[0])
284 {
285 case 'o':
286 switch (line[1])
287 {
288 case 'n':
289 return 1; /* on */
290 default:
291 return 0; /* o[ff] */
292 }
293 case 'y': /* y[es] */
294 case 'k': /* k[ylla] */
295 case 's':
296 case 'd':
297 return 1;
298 case 'n': /* n[o] */
299 case 'e': /* e[i] */
300 case 'u':
301 default:
302 return 0;
303 }
304}
305
306int 263int
307command_title (object *op, char *params) 264command_title (object *op, char *params)
308{ 265{
309 char buf[MAX_BUF]; 266 char buf[MAX_BUF];
310 267
313 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.");
314 return 1; 271 return 1;
315 } 272 }
316 273
317 /* dragon players cannot change titles */ 274 /* dragon players cannot change titles */
318 if (is_dragon_pl (op)) 275 if (op->is_dragon ())
319 { 276 {
320 new_draw_info (NDI_UNIQUE, 0, op, "Dragons cannot change titles."); 277 new_draw_info (NDI_UNIQUE, 0, op, "Dragons cannot change titles.");
321 return 1; 278 return 1;
322 } 279 }
323 280

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines