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.75 by root, Mon Oct 12 14:00:59 2009 UTC vs.
Revision 1.89 by root, Sat Nov 17 23:40:03 2018 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 (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * 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 10 * 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 11 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 12 * option) any later version.
12 * 13 *
13 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 17 * GNU General Public License for more details.
17 * 18 *
18 * You should have received a copy of the Affero GNU General Public License 19 * 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 20 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 21 * <http://www.gnu.org/licenses/>.
21 * 22 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 23 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 24 */
24 25
25#include <global.h> 26#include <global.h>
26#include <loader.h>
27#include <sproto.h> 27#include <sproto.h>
28 28
29/* Handles misc. input request - things like hash table, malloc, maps, etc */ 29/* Handles misc. input request - things like hash table, malloc, maps, etc */
30
31int
32command_motd (object *op, char *params)
33{
34 display_motd (op);
35 return 1;
36}
37
38typedef struct
39{
40 char namebuf[MAX_BUF];
41 int login_order;
42} chars_names;
43 30
44int 31int
45command_time (object *op, char *params) 32command_time (object *op, char *params)
46{ 33{
47 print_tod (op); 34 print_tod (op);
65 52
66 sprintf (buf, "Set debug level to %d.", i); 53 sprintf (buf, "Set debug level to %d.", i);
67 new_draw_info (NDI_UNIQUE, 0, op, buf); 54 new_draw_info (NDI_UNIQUE, 0, op, buf);
68 return 1; 55 return 1;
69} 56}
70
71 57
72/* 58/*
73 * Those dumps should be just one dump with good parser 59 * Those dumps should be just one dump with good parser
74 */ 60 */
75 61
217 " Wis %2d\n" 203 " Wis %2d\n"
218 " Cha %2d\n" 204 " Cha %2d\n"
219 " Pow %2d\n" 205 " Pow %2d\n"
220 " wc %d damage %d ac %d\n", 206 " wc %d damage %d ac %d\n",
221 &ob->name, 207 &ob->name,
222 &ob->name, 208 ob->level,
223 ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp, 209 ob->stats.hp, ob->stats.maxhp, ob->stats.sp, ob->stats.maxsp,
224 ob->stats.Str, 210 ob->stats.Str,
225 ob->stats.Dex, 211 ob->stats.Dex,
226 ob->stats.Con, 212 ob->stats.Con,
227 ob->stats.Int, 213 ob->stats.Int,
255 for (int i = 0; i < NROFATTACKS; i++) 241 for (int i = 0; i < NROFATTACKS; i++)
256 if (i != ATNR_INTERNAL) 242 if (i != ATNR_INTERNAL)
257 msg.printf (" %-20s %+4d\n", attacktype_desc [i], op->resist [i]); 243 msg.printf (" %-20s %+4d\n", attacktype_desc [i], op->resist [i]);
258 244
259 /* If dragon player, let's display natural resistances */ 245 /* If dragon player, let's display natural resistances */
260 if (is_dragon_pl (op)) 246 if (op->is_dragon ())
261 for (object *tmp = op->inv; tmp; tmp = tmp->below) 247 for (object *tmp = op->inv; tmp; tmp = tmp->below)
262 if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force) 248 if ((tmp->type == FORCE) && tmp->arch->archname == shstr_dragon_skin_force)
263 { 249 {
264 msg << "\nOf those, these are natural skin resistances:\n\n"; 250 msg << "\nOf those, these are natural skin resistances:\n\n";
265 251
273 op->contr->infobox (MSG_CHANNEL ("resistances"), msg); 259 op->contr->infobox (MSG_CHANNEL ("resistances"), msg);
274 260
275 return 0; 261 return 0;
276} 262}
277 263
278/*
279 * Actual commands.
280 * Those should be in small separate files (c_object.c, c_wiz.c, cmove.c,...)
281 */
282
283int
284onoff_value (const char *line)
285{
286 int i;
287
288 if (sscanf (line, "%d", &i))
289 return (i != 0);
290 switch (line[0])
291 {
292 case 'o':
293 switch (line[1])
294 {
295 case 'n':
296 return 1; /* on */
297 default:
298 return 0; /* o[ff] */
299 }
300 case 'y': /* y[es] */
301 case 'k': /* k[ylla] */
302 case 's':
303 case 'd':
304 return 1;
305 case 'n': /* n[o] */
306 case 'e': /* e[i] */
307 case 'u':
308 default:
309 return 0;
310 }
311}
312
313int 264int
314command_title (object *op, char *params) 265command_title (object *op, char *params)
315{ 266{
316 char buf[MAX_BUF]; 267 char buf[MAX_BUF];
317 268
320 new_draw_info (NDI_UNIQUE, 0, op, "You cannot change your title."); 271 new_draw_info (NDI_UNIQUE, 0, op, "You cannot change your title.");
321 return 1; 272 return 1;
322 } 273 }
323 274
324 /* dragon players cannot change titles */ 275 /* dragon players cannot change titles */
325 if (is_dragon_pl (op)) 276 if (op->is_dragon ())
326 { 277 {
327 new_draw_info (NDI_UNIQUE, 0, op, "Dragons cannot change titles."); 278 new_draw_info (NDI_UNIQUE, 0, op, "Dragons cannot change titles.");
328 return 1; 279 return 1;
329 } 280 }
330 281

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines