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.50 by root, Thu Aug 9 06:21:56 2007 UTC vs.
Revision 1.61 by root, Sat Dec 20 02:32:31 2008 UTC

1/* 1/*
2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Crossfire TRT is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * 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
10 * the Free Software Foundation, either version 3 of the License, or 10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version. 11 * (at your 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,
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 GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * 20 *
21 * The authors can be reached via e-mail to <crossfire@schmorp.de> 21 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 22 */
23 23
24#include <global.h> 24#include <global.h>
25#include <sproto.h> 25#include <sproto.h>
26#include <spells.h> 26#include <spells.h>
178command_kick (object *op, char *params) 178command_kick (object *op, char *params)
179{ 179{
180 for_all_players (pl) 180 for_all_players (pl)
181 if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params))) 181 if ((params == NULL || !strcmp (&pl->ob->name, params)) && !INVOKE_PLAYER (KICK, pl, ARG_STRING (params)))
182 { 182 {
183 object *op = pl->ob; 183 object *plop = pl->ob;
184 184
185 if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED)) 185 if (!QUERY_FLAG (plop, FLAG_REMOVED) && !QUERY_FLAG (plop, FLAG_FREED))
186 { 186 {
187 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &op->name); 187 new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_RED, 5, op, "%s is kicked out of the game.", &plop->name);
188 strcpy (op->contr->killer, "kicked"); 188 plop->contr->killer = op;
189 } 189 }
190 190
191 pl->ns->destroy (); 191 pl->ns->destroy ();
192 } 192 }
193 193
279 /* we have nowhere to send the prisoner.... */ 279 /* we have nowhere to send the prisoner.... */
280 new_draw_info (NDI_UNIQUE, 0, op, "can't jail player, there is no map to hold them"); 280 new_draw_info (NDI_UNIQUE, 0, op, "can't jail player, there is no map to hold them");
281 return 0; 281 return 0;
282 } 282 }
283 283
284 pl->ob->enter_exit (dummy); 284 pl->ob->player_goto (dummy->slaying, dummy->stats.hp, dummy->stats.sp);//TODO
285 dummy->destroy (); 285 dummy->destroy ();
286
286 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You have been arrested."); 287 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You have been arrested.");
287 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 288 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
288 LOG (llevInfo, "Player %s arrested by %s\n", &pl->ob->name, &op->name); 289 LOG (llevInfo, "Player %s arrested by %s\n", &pl->ob->name, &op->name);
289 return 1; 290 return 1;
290} 291}
314 { 315 {
315 new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); 316 new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player.");
316 return 1; 317 return 1;
317 } 318 }
318 319
319 dummy = object::create (); 320 pl->ob->player_goto (op->map->path, op->x + freearr_x[i], op->y + freearr_y[i]);
320 EXIT_PATH (dummy) = op->map->path;
321 EXIT_X (dummy) = op->x + freearr_x[i];
322 EXIT_Y (dummy) = op->y + freearr_y[i];
323 pl->ob->enter_exit (dummy);
324 dummy->destroy ();
325 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); 321 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned.");
326 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 322 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
327 323
328 return 1; 324 return 1;
329} 325}
574 } 570 }
575 571
576 if (at->nrof) 572 if (at->nrof)
577 { 573 {
578 if (at_spell) 574 if (at_spell)
579 insert_ob_in_ob (arch_to_object (at_spell), tmp); 575 tmp->insert (arch_to_object (at_spell));
580 576
581 tmp->x = op->x; 577 tmp->x = op->x;
582 tmp->y = op->y; 578 tmp->y = op->y;
579 tmp->map = op->map;
583 580
584 if (set_nrof) 581 if (set_nrof)
585 tmp->nrof = nrof; 582 tmp->nrof = nrof;
586 583
587 tmp->map = op->map; 584 op->insert (tmp);
588
589 tmp = insert_ob_in_ob (tmp, op);
590 esrv_send_item (op, tmp);
591 585
592 /* Let's put this created item on stack so dm can access it easily. */ 586 /* Let's put this created item on stack so dm can access it easily. */
593 dm_stack_push (op->contr, tmp->count); 587 dm_stack_push (op->contr, tmp->count);
594 588
595 return 1; 589 return 1;
673 /* Wonder if we really want to push all of these, but since 667 /* Wonder if we really want to push all of these, but since
674 * things like rods have nrof 0, we want to cover those. 668 * things like rods have nrof 0, we want to cover those.
675 */ 669 */
676 dm_stack_push (op->contr, head->count); 670 dm_stack_push (op->contr, head->count);
677 671
678 if (at->randomitems != NULL && !at_spell) 672 if (at->randomitems && !at_spell)
679 create_treasure (at->randomitems, head, GT_APPLY, op->map->difficulty, 0); 673 create_treasure (at->randomitems, head, GT_APPLY, op->map->difficulty, 0);
680
681 esrv_send_item (op, head);
682 } 674 }
683 675
684 /* free the one we used to copy */ 676 /* free the one we used to copy */
685 tmp->destroy (); 677 tmp->destroy ();
686 } 678 }
693 */ 685 */
694 686
695int 687int
696command_inventory (object *op, char *params) 688command_inventory (object *op, char *params)
697{ 689{
690 int i;
698 object *tmp; 691 object *tmp;
699 int i;
700 692
701 if (!params) 693 if (!params || !sscanf (params, "%d", &i) || !(tmp = find_object (i)))
702 { 694 {
703 inventory (op, NULL); 695 op->contr->failmsg ("Inventory of what object (nr)?");
704 return 0; 696 return 1;
705 }
706
707 if (!sscanf (params, "%d", &i) || (tmp = find_object (i)) == NULL)
708 { 697 }
709 new_draw_info (NDI_UNIQUE, 0, op, "Inventory of what object (nr)?");
710 return 1;
711 }
712 698
713 inventory (op, tmp); 699 op->contr->infobox (MSG_CHANNEL ("examine"), tmp->query_inventory (op));
700
714 return 1; 701 return 1;
715} 702}
716 703
717/* just show player's their skills for now. Dm's can 704/* just show player's their skills for now. Dm's can
718 * already see skills w/ inventory command - b.t. 705 * already see skills w/ inventory command - b.t.
1064 * Remove setting flying here - that won't work, because next 1051 * Remove setting flying here - that won't work, because next
1065 * fix_player() is called that will get cleared - proper solution 1052 * fix_player() is called that will get cleared - proper solution
1066 * is probably something like a wiz_force which gives that and any 1053 * is probably something like a wiz_force which gives that and any
1067 * other desired abilities. 1054 * other desired abilities.
1068 */ 1055 */
1069 clear_los (op->contr); 1056 op->contr->clear_los (0);
1070 op->contr->write_buf[0] = '\0'; 1057 op->contr->write_buf[0] = '\0';
1071 1058
1072 if (!silent) 1059 if (!silent)
1073 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!"); 1060 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!");
1074 1061
1268 new_draw_info_format (NDI_UNIQUE, 0, op, "You do not know the spell %s.", params); 1255 new_draw_info_format (NDI_UNIQUE, 0, op, "You do not know the spell %s.", params);
1269 return 0; 1256 return 0;
1270 } 1257 }
1271 1258
1272 do_forget_spell (op, spell->name); 1259 do_forget_spell (op, spell->name);
1273 return 1;
1274}
1275
1276/**
1277 * Lists all plugins currently loaded with their IDs and full names.
1278 */
1279int
1280command_listplugins (object *op, char *params)
1281{
1282 plugins_display_list (op);
1283 return 1;
1284}
1285
1286/**
1287 * Loads the given plugin. The DM specifies the name of the library to load (no
1288 * pathname is needed). Do not ever attempt to load the same plugin more than
1289 * once at a time, or bad things could happen.
1290 */
1291int
1292command_loadplugin (object *op, char *params)
1293{
1294 char buf[MAX_BUF];
1295
1296 if (params == NULL)
1297 {
1298 new_draw_info (NDI_UNIQUE, 0, op, "Load which plugin?");
1299 return 1;
1300 }
1301
1302 strcpy (buf, LIBDIR);
1303 strcat (buf, "/plugins/");
1304 strcat (buf, params);
1305 LOG (llevDebug, "Requested plugin file is %s\n", buf);
1306 if (plugins_init_plugin (buf) == 0)
1307 new_draw_info (NDI_UNIQUE, 0, op, "Plugin successfully loaded.");
1308 else
1309 new_draw_info (NDI_UNIQUE, 0, op, "Could not load plugin.");
1310 return 1;
1311}
1312
1313/**
1314 * Unloads the given plugin. The DM specified the ID of the library to unload.
1315 * Note that some things may behave strangely if the correct plugins are not
1316 * loaded.
1317 */
1318int
1319command_unloadplugin (object *op, char *params)
1320{
1321 if (params == NULL)
1322 {
1323 new_draw_info (NDI_UNIQUE, 0, op, "Remove which plugin?");
1324 return 1;
1325 }
1326
1327 if (plugins_remove_plugin (params) == 0)
1328 new_draw_info (NDI_UNIQUE, 0, op, "Plugin successfully removed.");
1329 else
1330 new_draw_info (NDI_UNIQUE, 0, op, "Could not remove plugin.");
1331 return 1; 1260 return 1;
1332} 1261}
1333 1262
1334/** 1263/**
1335 * A players wants to become DM and hide. 1264 * A players wants to become DM and hide.
1656 return 0; 1585 return 0;
1657 } 1586 }
1658 1587
1659 if (!QUERY_FLAG (right, FLAG_REMOVED)) 1588 if (!QUERY_FLAG (right, FLAG_REMOVED))
1660 right->remove (); 1589 right->remove ();
1590
1661 inserted = insert_ob_in_ob (right, left); 1591 insert_ob_in_ob (right, left);
1662 if (left->type == PLAYER)
1663 if (inserted == right)
1664 esrv_send_item (left, right);
1665 else
1666 esrv_update_item (UPD_WEIGHT | UPD_NAME | UPD_NROF, left, inserted);
1667 1592
1668 new_draw_info_format (NDI_UNIQUE, 0, op, "Inserted %s in %s", query_name (inserted), query_name (left)); 1593 new_draw_info_format (NDI_UNIQUE, 0, op, "Inserted %s in %s", query_name (inserted), query_name (left));
1669 1594
1670 return 0; 1595 return 0;
1671 1596

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines