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.48 by root, Tue Jun 5 13:05:02 2007 UTC vs.
Revision 1.58 by root, Tue May 6 16:55:26 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 it 8 * Deliantra is free software: you can redistribute it and/or modify
9 * under the terms of the GNU General Public License as published by the Free 9 * it under the terms of the GNU General Public License as published by
10 * Software Foundation; either version 2 of the License, or (at your option) 10 * the Free Software Foundation, either version 3 of the License, or
11 * 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, but 13 * This program is distributed in the hope that it will be useful,
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * 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 along 18 * You should have received a copy of the GNU General Public License
19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * 20 *
22 * 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>
23 */ 22 */
24 23
25#include <global.h> 24#include <global.h>
26#include <sproto.h> 25#include <sproto.h>
27#include <spells.h> 26#include <spells.h>
179command_kick (object *op, char *params) 178command_kick (object *op, char *params)
180{ 179{
181 for_all_players (pl) 180 for_all_players (pl)
182 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)))
183 { 182 {
184 object *op = pl->ob; 183 object *plop = pl->ob;
185 184
186 if (!QUERY_FLAG (op, FLAG_REMOVED) && !QUERY_FLAG (op, FLAG_FREED)) 185 if (!QUERY_FLAG (plop, FLAG_REMOVED) && !QUERY_FLAG (plop, FLAG_FREED))
187 { 186 {
188 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);
189 strcpy (op->contr->killer, "kicked"); 188 plop->contr->killer = op;
190 } 189 }
191 190
192 pl->ns->destroy (); 191 pl->ns->destroy ();
193 } 192 }
194 193
280 /* we have nowhere to send the prisoner.... */ 279 /* we have nowhere to send the prisoner.... */
281 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");
282 return 0; 281 return 0;
283 } 282 }
284 283
285 pl->ob->enter_exit (dummy); 284 pl->ob->player_goto (dummy->slaying, dummy->stats.hp, dummy->stats.sp);//TODO
286 dummy->destroy (); 285 dummy->destroy ();
287 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You have been arrested."); 286 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You have been arrested.");
288 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 287 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
289 LOG (llevInfo, "Player %s arrested by %s\n", &pl->ob->name, &op->name); 288 LOG (llevInfo, "Player %s arrested by %s\n", &pl->ob->name, &op->name);
290 return 1; 289 return 1;
315 { 314 {
316 new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); 315 new_draw_info (NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player.");
317 return 1; 316 return 1;
318 } 317 }
319 318
320 dummy = object::create (); 319 pl->ob->player_goto (op->map->path, op->x + freearr_x[i], op->y + freearr_y[i]);
321 EXIT_PATH (dummy) = op->map->path;
322 EXIT_X (dummy) = op->x + freearr_x[i];
323 EXIT_Y (dummy) = op->y + freearr_y[i];
324 pl->ob->enter_exit (dummy);
325 dummy->destroy ();
326 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned."); 320 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned.");
327 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 321 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
328 322
329 return 1; 323 return 1;
330} 324}
575 } 569 }
576 570
577 if (at->nrof) 571 if (at->nrof)
578 { 572 {
579 if (at_spell) 573 if (at_spell)
580 insert_ob_in_ob (arch_to_object (at_spell), tmp); 574 tmp->insert (arch_to_object (at_spell));
581 575
582 tmp->x = op->x; 576 tmp->x = op->x;
583 tmp->y = op->y; 577 tmp->y = op->y;
578 tmp->map = op->map;
584 579
585 if (set_nrof) 580 if (set_nrof)
586 tmp->nrof = nrof; 581 tmp->nrof = nrof;
587 582
588 tmp->map = op->map; 583 op->insert (tmp);
589
590 tmp = insert_ob_in_ob (tmp, op);
591 esrv_send_item (op, tmp);
592 584
593 /* Let's put this created item on stack so dm can access it easily. */ 585 /* Let's put this created item on stack so dm can access it easily. */
594 dm_stack_push (op->contr, tmp->count); 586 dm_stack_push (op->contr, tmp->count);
595 587
596 return 1; 588 return 1;
674 /* Wonder if we really want to push all of these, but since 666 /* Wonder if we really want to push all of these, but since
675 * things like rods have nrof 0, we want to cover those. 667 * things like rods have nrof 0, we want to cover those.
676 */ 668 */
677 dm_stack_push (op->contr, head->count); 669 dm_stack_push (op->contr, head->count);
678 670
679 if (at->randomitems != NULL && !at_spell) 671 if (at->randomitems && !at_spell)
680 create_treasure (at->randomitems, head, GT_APPLY, op->map->difficulty, 0); 672 create_treasure (at->randomitems, head, GT_APPLY, op->map->difficulty, 0);
681
682 esrv_send_item (op, head);
683 } 673 }
684 674
685 /* free the one we used to copy */ 675 /* free the one we used to copy */
686 tmp->destroy (); 676 tmp->destroy ();
687 } 677 }
694 */ 684 */
695 685
696int 686int
697command_inventory (object *op, char *params) 687command_inventory (object *op, char *params)
698{ 688{
689 int i;
699 object *tmp; 690 object *tmp;
700 int i;
701 691
702 if (!params) 692 if (!params || !sscanf (params, "%d", &i) || !(tmp = find_object (i)))
703 { 693 {
704 inventory (op, NULL); 694 op->contr->failmsg ("Inventory of what object (nr)?");
705 return 0; 695 return 1;
706 }
707
708 if (!sscanf (params, "%d", &i) || (tmp = find_object (i)) == NULL)
709 { 696 }
710 new_draw_info (NDI_UNIQUE, 0, op, "Inventory of what object (nr)?");
711 return 1;
712 }
713 697
714 inventory (op, tmp); 698 op->contr->infobox (MSG_CHANNEL ("examine"), tmp->query_inventory (op));
699
715 return 1; 700 return 1;
716} 701}
717 702
718/* just show player's their skills for now. Dm's can 703/* just show player's their skills for now. Dm's can
719 * already see skills w/ inventory command - b.t. 704 * already see skills w/ inventory command - b.t.
841 */ 826 */
842int 827int
843command_addexp (object *op, char *params) 828command_addexp (object *op, char *params)
844{ 829{
845 char buf[MAX_BUF], skill[MAX_BUF]; 830 char buf[MAX_BUF], skill[MAX_BUF];
846 int i, q; 831 int q;
832 long long i; // use sint64 and finally provide format specifiers for sint64 etc. via configure
847 object *skillob = NULL; 833 object *skillob = NULL;
848 834
849 skill[0] = '\0'; 835 skill[0] = '\0';
850 if ((params == NULL) || (strlen (params) > MAX_BUF) || ((q = sscanf (params, "%s %d %s", buf, &i, skill)) < 2)) 836 if ((params == NULL) || (strlen (params) > MAX_BUF) || ((q = sscanf (params, "%s %lld %s", buf, &i, skill)) < 2))
851 { 837 {
852 new_draw_info (NDI_UNIQUE, 0, op, "Usage: addexp <who> <how much> [<skill>]."); 838 new_draw_info (NDI_UNIQUE, 0, op, "Usage: addexp <who> <how much> [<skill>].");
853 return 1; 839 return 1;
854 } 840 }
855 841
1272 do_forget_spell (op, spell->name); 1258 do_forget_spell (op, spell->name);
1273 return 1; 1259 return 1;
1274} 1260}
1275 1261
1276/** 1262/**
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;
1332}
1333
1334/**
1335 * A players wants to become DM and hide. 1263 * A players wants to become DM and hide.
1336 * Let's see if that's authorized. 1264 * Let's see if that's authorized.
1337 * Make sure to not tell anything to anyone. 1265 * Make sure to not tell anything to anyone.
1338 */ 1266 */
1339int 1267int
1656 return 0; 1584 return 0;
1657 } 1585 }
1658 1586
1659 if (!QUERY_FLAG (right, FLAG_REMOVED)) 1587 if (!QUERY_FLAG (right, FLAG_REMOVED))
1660 right->remove (); 1588 right->remove ();
1589
1661 inserted = insert_ob_in_ob (right, left); 1590 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 1591
1668 new_draw_info_format (NDI_UNIQUE, 0, op, "Inserted %s in %s", query_name (inserted), query_name (left)); 1592 new_draw_info_format (NDI_UNIQUE, 0, op, "Inserted %s in %s", query_name (inserted), query_name (left));
1669 1593
1670 return 0; 1594 return 0;
1671 1595

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines