… | |
… | |
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 Crossfire TRT 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 | * Crossfire TRT 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 <crossfire@schmorp.de> |
23 | */ |
22 | */ |
24 | |
23 | |
25 | #include <global.h> |
24 | #include <global.h> |
… | |
… | |
841 | */ |
840 | */ |
842 | int |
841 | int |
843 | command_addexp (object *op, char *params) |
842 | command_addexp (object *op, char *params) |
844 | { |
843 | { |
845 | char buf[MAX_BUF], skill[MAX_BUF]; |
844 | char buf[MAX_BUF], skill[MAX_BUF]; |
846 | int i, q; |
845 | int q; |
|
|
846 | long long i; // use sint64 and finally provide format specifiers for sint64 etc. via configure |
847 | object *skillob = NULL; |
847 | object *skillob = NULL; |
848 | |
848 | |
849 | skill[0] = '\0'; |
849 | skill[0] = '\0'; |
850 | if ((params == NULL) || (strlen (params) > MAX_BUF) || ((q = sscanf (params, "%s %d %s", buf, &i, skill)) < 2)) |
850 | if ((params == NULL) || (strlen (params) > MAX_BUF) || ((q = sscanf (params, "%s %lld %s", buf, &i, skill)) < 2)) |
851 | { |
851 | { |
852 | new_draw_info (NDI_UNIQUE, 0, op, "Usage: addexp <who> <how much> [<skill>]."); |
852 | new_draw_info (NDI_UNIQUE, 0, op, "Usage: addexp <who> <how much> [<skill>]."); |
853 | return 1; |
853 | return 1; |
854 | } |
854 | } |
855 | |
855 | |
… | |
… | |
1272 | do_forget_spell (op, spell->name); |
1272 | do_forget_spell (op, spell->name); |
1273 | return 1; |
1273 | return 1; |
1274 | } |
1274 | } |
1275 | |
1275 | |
1276 | /** |
1276 | /** |
1277 | * Lists all plugins currently loaded with their IDs and full names. |
|
|
1278 | */ |
|
|
1279 | int |
|
|
1280 | command_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 | */ |
|
|
1291 | int |
|
|
1292 | command_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 | */ |
|
|
1318 | int |
|
|
1319 | command_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. |
1277 | * A players wants to become DM and hide. |
1336 | * Let's see if that's authorized. |
1278 | * Let's see if that's authorized. |
1337 | * Make sure to not tell anything to anyone. |
1279 | * Make sure to not tell anything to anyone. |
1338 | */ |
1280 | */ |
1339 | int |
1281 | int |