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

Comparing deliantra/server/server/c_wiz.C (file contents):
Revision 1.28 by root, Sat Dec 30 10:16:11 2006 UTC vs.
Revision 1.37 by pippijn, Fri Mar 2 13:32:52 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 * CrossFire, A Multiplayer game for X-windows
3 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
6 7 *
7 This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 11 * (at your option) any later version.
11 12 *
12 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,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 16 * GNU General Public License for more details.
16 17 *
17 You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 21 *
21 The authors can be reached via e-mail at <crossfire@schmorp.de> 22 * The authors can be reached via e-mail at <crossfire@schmorp.de>
22*/ 23 */
23 24
24#include <global.h> 25#include <global.h>
25#ifndef __CEXTRACT__
26# include <sproto.h> 26#include <sproto.h>
27#endif
28#include <spells.h> 27#include <spells.h>
29#include <treasure.h> 28#include <treasure.h>
30#include <skills.h> 29#include <skills.h>
31 30
32/** Defines for DM item stack **/ 31/** Defines for DM item stack **/
87 op->contr->hidden = 0; 86 op->contr->hidden = 0;
88 op->invisible = 1; 87 op->invisible = 1;
89 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players"); 88 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players");
90 op->map->players++; 89 op->map->players++;
91 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s has entered the game.", &op->name); 90 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s has entered the game.", &op->name);
91
92 if (!silent_dm) 92 if (!silent_dm)
93 {
94 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!"); 93 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!");
95 }
96 } 94 }
97 else 95 else
98 { 96 {
99 op->contr->hidden = 1; 97 op->contr->hidden = 1;
100 new_draw_info (NDI_UNIQUE, 0, op, "Other players will no longer see you."); 98 new_draw_info (NDI_UNIQUE, 0, op, "Other players will no longer see you.");
101 op->map->players--; 99 op->map->players--;
100
102 if (!silent_dm) 101 if (!silent_dm)
103 {
104 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master is gone.."); 102 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master is gone..");
105 } 103
106 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s leaves the game.", &op->name); 104 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s leaves the game.", &op->name);
107 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s left the game.", &op->name); 105 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s left the game.", &op->name);
108 } 106 }
109} 107}
110 108
171 new_draw_info_format (NDI_UNIQUE, 0, op, "No such god %s.", str); 169 new_draw_info_format (NDI_UNIQUE, 0, op, "No such god %s.", str);
172 return 1; 170 return 1;
173 } 171 }
174 172
175 become_follower (ob, god); 173 become_follower (ob, god);
174 return 1;
175}
176
177// TODO: Rewrite banish in perl and get rid of the following two functions
178int
179command_kick (object *op, char *params)
180{
181 for_all_players (pl)
182 if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params)))
183 {
184 object *op = pl->ob;
185
186 if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED))
187 {
188 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &op->name);
189 strcpy (op->contr->killer, "kicked");
190 }
191
192 pl->ns->destroy ();
193 }
194
176 return 1; 195 return 1;
177} 196}
178 197
179/** 198/**
180 * Add player's IP to ban_file and kick them off the server 199 * Add player's IP to ban_file and kick them off the server
224 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s banishes %s from the land!", &op->name, &pl->ob->name); 243 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s banishes %s from the land!", &op->name, &pl->ob->name);
225 command_kick (op, (char *) &pl->ob->name); 244 command_kick (op, (char *) &pl->ob->name);
226 return 1; 245 return 1;
227} 246}
228 247
229int
230command_kick (object *op, char *params)
231{
232 for_all_players (pl)
233 if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params)))
234 {
235 object *op = pl->ob;
236
237 if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED))
238 {
239 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &op->name);
240 strcpy (op->contr->killer, "kicked");
241 }
242
243 pl->ns->destroy ();
244 }
245
246 return 1;
247}
248
249//TODO 248//TODO
250#if 0 249#if 0
251int 250int
252command_save_overlay (object *op, char *params) 251command_save_overlay (object *op, char *params)
253{ 252{
271#endif 270#endif
272 271
273int 272int
274command_shutdown (object *op, char *params) 273command_shutdown (object *op, char *params)
275{ 274{
276 if (op != NULL && !QUERY_FLAG (op, FLAG_WIZ)) 275 if (op && !QUERY_FLAG (op, FLAG_WIZ))
277 { 276 {
278 new_draw_info (NDI_UNIQUE, 0, op, "Sorry, you can't shutdown the server."); 277 new_draw_info (NDI_UNIQUE, 0, op, "Sorry, you can't shutdown the server.");
279 return 1; 278 return 1;
280 } 279 }
281 280
282 cleanup (0); 281 cleanup ("dm initiated shutdown", 0);
283 282
284 /* not reached */ 283 /* not reached */
285 return 1; 284 return 1;
286} 285}
287 286
390 pl->ob->enter_exit (dummy); 389 pl->ob->enter_exit (dummy);
391 dummy->destroy (); 390 dummy->destroy ();
392 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); 391 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned.");
393 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 392 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
394 393
395 return 1;
396}
397
398/**
399 * Teleport next to target player.
400 */
401
402/* mids 01/16/2002 */
403int
404command_teleport (object *op, char *params)
405{
406 int i;
407 object *dummy;
408 player *pl;
409
410 if (!op)
411 return 0;
412
413 if (params == NULL)
414 {
415 new_draw_info (NDI_UNIQUE, 0, op, "Usage: teleport <player>.");
416 return 1;
417 }
418
419 pl = get_other_player_from_name (op, params);
420 if (!pl)
421 return 1;
422
423 i = find_free_spot (pl->ob, pl->ob->map, pl->ob->x, pl->ob->y, 1, 9);
424 if (i == -1)
425 {
426 new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to teleport to.");
427 return 1;
428 }
429
430 dummy = object::create ();
431 EXIT_PATH (dummy) = pl->ob->map->path;
432 EXIT_X (dummy) = pl->ob->x + freearr_x[i];
433 EXIT_Y (dummy) = pl->ob->y + freearr_y[i];
434 op->enter_exit (dummy);
435 dummy->destroy ();
436 if (!op->contr->hidden)
437 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You see a portal open.");
438 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
439 return 1; 394 return 1;
440} 395}
441 396
442/** 397/**
443 * This function is a real mess, because we're stucking getting 398 * This function is a real mess, because we're stucking getting
537 at_spell = archetype::find (cp); 492 at_spell = archetype::find (cp);
538 if (!at_spell || at_spell->clone.type != SPELL) 493 if (!at_spell || at_spell->clone.type != SPELL)
539 at_spell = find_archetype_by_object_name (cp); 494 at_spell = find_archetype_by_object_name (cp);
540 if (!at_spell || at_spell->clone.type != SPELL) 495 if (!at_spell || at_spell->clone.type != SPELL)
541 { 496 {
542 strcpy (spell_name, cp); 497 assign (spell_name, cp);
543 fsp = strchr (spell_name, ' '); 498 fsp = strchr (spell_name, ' ');
544 if (fsp) 499 if (fsp)
545 { 500 {
546 *fsp = 0; 501 *fsp = 0;
547 fsp++; 502 fsp++;
1050 1005
1051 if (from != STACK_FROM_STACK) 1006 if (from != STACK_FROM_STACK)
1052 /* Item is either stack top, or is a number thus is now stack top, let's remove it */ 1007 /* Item is either stack top, or is a number thus is now stack top, let's remove it */
1053 dm_stack_pop (op->contr); 1008 dm_stack_pop (op->contr);
1054 1009
1055 if (!QUERY_FLAG (tmp, FLAG_REMOVED))
1056 {
1057 new_draw_info (NDI_UNIQUE, 0, op, "Warning, item wasn't removed.");
1058 tmp->remove ();
1059 }
1060
1061 if (tmp->head) 1010 if (tmp->head)
1062 tmp = tmp->head; 1011 tmp = tmp->head;
1063 1012
1064 tmp->destroy (); 1013 tmp->destroy ();
1065 return 1; 1014 return 1;
1162int 1111int
1163command_abil (object *op, char *params) 1112command_abil (object *op, char *params)
1164{ 1113{
1165 char thing[20], thing2[20]; 1114 char thing[20], thing2[20];
1166 int iii; 1115 int iii;
1167 player *pl;
1168 char buf[MAX_BUF]; 1116 char buf[MAX_BUF];
1169 1117
1170 iii = 0; 1118 iii = 0;
1171 thing[0] = '\0'; 1119 thing[0] = '\0';
1172 thing2[0] = '\0'; 1120 thing2[0] = '\0';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines