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.53 by root, Thu Nov 8 19:43:26 2007 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 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>
694 */ 693 */
695 694
696int 695int
697command_inventory (object *op, char *params) 696command_inventory (object *op, char *params)
698{ 697{
698 int i;
699 object *tmp; 699 object *tmp;
700 int i;
701 700
702 if (!params) 701 if (!params || !sscanf (params, "%d", &i) || !(tmp = find_object (i)))
703 { 702 {
704 inventory (op, NULL); 703 op->contr->failmsg ("Inventory of what object (nr)?");
705 return 0; 704 return 1;
706 }
707
708 if (!sscanf (params, "%d", &i) || (tmp = find_object (i)) == NULL)
709 { 705 }
710 new_draw_info (NDI_UNIQUE, 0, op, "Inventory of what object (nr)?");
711 return 1;
712 }
713 706
714 inventory (op, tmp); 707 op->contr->infobox (MSG_CHANNEL ("examine"), tmp->query_inventory (op));
708
715 return 1; 709 return 1;
716} 710}
717 711
718/* just show player's their skills for now. Dm's can 712/* just show player's their skills for now. Dm's can
719 * already see skills w/ inventory command - b.t. 713 * already see skills w/ inventory command - b.t.
841 */ 835 */
842int 836int
843command_addexp (object *op, char *params) 837command_addexp (object *op, char *params)
844{ 838{
845 char buf[MAX_BUF], skill[MAX_BUF]; 839 char buf[MAX_BUF], skill[MAX_BUF];
846 int i, q; 840 int q;
841 long long i; // use sint64 and finally provide format specifiers for sint64 etc. via configure
847 object *skillob = NULL; 842 object *skillob = NULL;
848 843
849 skill[0] = '\0'; 844 skill[0] = '\0';
850 if ((params == NULL) || (strlen (params) > MAX_BUF) || ((q = sscanf (params, "%s %d %s", buf, &i, skill)) < 2)) 845 if ((params == NULL) || (strlen (params) > MAX_BUF) || ((q = sscanf (params, "%s %lld %s", buf, &i, skill)) < 2))
851 { 846 {
852 new_draw_info (NDI_UNIQUE, 0, op, "Usage: addexp <who> <how much> [<skill>]."); 847 new_draw_info (NDI_UNIQUE, 0, op, "Usage: addexp <who> <how much> [<skill>].");
853 return 1; 848 return 1;
854 } 849 }
855 850
1272 do_forget_spell (op, spell->name); 1267 do_forget_spell (op, spell->name);
1273 return 1; 1268 return 1;
1274} 1269}
1275 1270
1276/** 1271/**
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. 1272 * A players wants to become DM and hide.
1336 * Let's see if that's authorized. 1273 * Let's see if that's authorized.
1337 * Make sure to not tell anything to anyone. 1274 * Make sure to not tell anything to anyone.
1338 */ 1275 */
1339int 1276int

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines