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.44 by root, Mon May 28 21:28:36 2007 UTC vs.
Revision 1.63 by root, Sun Dec 28 03:59:19 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 ();
286
287 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.");
288 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 288 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
289 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);
290 return 1; 290 return 1;
291} 291}
315 { 315 {
316 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.");
317 return 1; 317 return 1;
318 } 318 }
319 319
320 dummy = object::create (); 320 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."); 321 new_draw_info (NDI_UNIQUE, 0, pl->ob, "You are summoned.");
327 new_draw_info (NDI_UNIQUE, 0, op, "OK."); 322 new_draw_info (NDI_UNIQUE, 0, op, "OK.");
328 323
329 return 1; 324 return 1;
330} 325}
423 * we also set up spell_name which is only 418 * we also set up spell_name which is only
424 * the first word. 419 * the first word.
425 */ 420 */
426 421
427 at_spell = archetype::find (cp); 422 at_spell = archetype::find (cp);
428 if (!at_spell || at_spell->clone.type != SPELL) 423 if (!at_spell || at_spell->type != SPELL)
429 at_spell = find_archetype_by_object_name (cp); 424 at_spell = find_archetype_by_object_name (cp);
430 if (!at_spell || at_spell->clone.type != SPELL) 425 if (!at_spell || at_spell->type != SPELL)
431 { 426 {
432 assign (spell_name, cp); 427 assign (spell_name, cp);
433 fsp = strchr (spell_name, ' '); 428 fsp = strchr (spell_name, ' ');
434 if (fsp) 429 if (fsp)
435 { 430 {
436 *fsp = 0; 431 *fsp = 0;
437 fsp++; 432 fsp++;
438 at_spell = archetype::find (spell_name); 433 at_spell = archetype::find (spell_name);
439 434
440 /* Got a spell, update the first string pointer */ 435 /* Got a spell, update the first string pointer */
441 if (at_spell && at_spell->clone.type == SPELL) 436 if (at_spell && at_spell->type == SPELL)
442 bp2 = cp + strlen (spell_name) + 1; 437 bp2 = cp + strlen (spell_name) + 1;
443 else 438 else
444 at_spell = NULL; 439 at_spell = NULL;
445 } 440 }
446 } 441 }
448 /* OK - we didn't find a spell - presume the 'of' 443 /* OK - we didn't find a spell - presume the 'of'
449 * in this case means its an artifact. 444 * in this case means its an artifact.
450 */ 445 */
451 if (!at_spell) 446 if (!at_spell)
452 { 447 {
453 if (find_artifactlist (at->clone.type) == NULL) 448 if (find_artifactlist (at->type) == NULL)
454 new_draw_info_format (NDI_UNIQUE, 0, op, "No artifact list for type %d\n", at->clone.type); 449 new_draw_info_format (NDI_UNIQUE, 0, op, "No artifact list for type %d\n", at->type);
455 else 450 else
456 { 451 {
457 art = find_artifactlist (at->clone.type)->items; 452 art = find_artifactlist (at->type)->items;
458 453
459 while (art) 454 while (art)
460 { 455 {
461 if (!strcmp (art->item->name, cp)) 456 if (!strcmp (art->item->name, cp))
462 break; 457 break;
463 458
464 art = art->next; 459 art = art->next;
465 } 460 }
466 461
467 if (!art) 462 if (!art)
468 new_draw_info_format (NDI_UNIQUE, 0, op, "No such artifact ([%d] of %s)", at->clone.type, cp); 463 new_draw_info_format (NDI_UNIQUE, 0, op, "No such artifact ([%d] of %s)", at->type, cp);
469 } 464 }
470 465
471 LOG (llevDebug, "%s creates: (%d) (%d) (%s) of (%s)\n", &op->name, set_nrof ? nrof : 0, set_magic ? magic : 0, bp, cp); 466 LOG (llevDebug, "%s creates: (%d) (%d) (%s) of (%s)\n", &op->name, set_nrof ? nrof : 0, set_magic ? magic : 0, bp, cp);
472 } 467 }
473 } /* if cp */ 468 } /* if cp */
474 469
475 if ((at->clone.type == ROD || at->clone.type == WAND || at->clone.type == SCROLL || 470 if ((at->type == ROD || at->type == WAND || at->type == SCROLL ||
476 at->clone.type == HORN || at->clone.type == SPELLBOOK) && !at_spell) 471 at->type == HORN || at->type == SPELLBOOK) && !at_spell)
477 { 472 {
478 new_draw_info_format (NDI_UNIQUE, 0, op, "Unable to find spell %s for object that needs it, or it is of wrong type", cp); 473 new_draw_info_format (NDI_UNIQUE, 0, op, "Unable to find spell %s for object that needs it, or it is of wrong type", cp);
479 return 1; 474 return 1;
480 } 475 }
481 476
572 new_draw_info_format (NDI_UNIQUE, 0, op, "(%s#%d)->%s", &tmp->name, tmp->count, bp2); 567 new_draw_info_format (NDI_UNIQUE, 0, op, "(%s#%d)->%s", &tmp->name, tmp->count, bp2);
573 568
574 bp2 = bp3 + 1; 569 bp2 = bp3 + 1;
575 } 570 }
576 571
577 if (at->clone.nrof) 572 if (at->nrof)
578 { 573 {
579 if (at_spell) 574 if (at_spell)
580 insert_ob_in_ob (arch_to_object (at_spell), tmp); 575 tmp->insert (arch_to_object (at_spell));
581 576
582 tmp->x = op->x; 577 tmp->x = op->x;
583 tmp->y = op->y; 578 tmp->y = op->y;
579 tmp->map = op->map;
584 580
585 if (set_nrof) 581 if (set_nrof)
586 tmp->nrof = nrof; 582 tmp->nrof = nrof;
587 583
588 tmp->map = op->map; 584 op->insert (tmp);
589
590 tmp = insert_ob_in_ob (tmp, op);
591 esrv_send_item (op, tmp);
592 585
593 /* 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. */
594 dm_stack_push (op->contr, tmp->count); 587 dm_stack_push (op->contr, tmp->count);
595 588
596 return 1; 589 return 1;
597 } 590 }
598 else 591 else
599 { 592 {
600 for (i = 0; i < (set_nrof ? nrof : 1); i++) 593 for (i = 0; i < (set_nrof ? nrof : 1); i++)
601 { 594 {
602 archetype *atmp;
603 object *prev = 0, *head = 0; 595 object *prev = 0, *head = 0;
604 596
605 for (atmp = at; atmp; atmp = atmp->more) 597 for (archetype *atmp = at; atmp; atmp = (archetype *)atmp->more)
606 { 598 {
607 object *dup = arch_to_object (atmp); 599 object *dup = arch_to_object (atmp);
608 600
609 if (at_spell) 601 if (at_spell)
610 insert_ob_in_ob (arch_to_object (at_spell), dup); 602 insert_ob_in_ob (arch_to_object (at_spell), dup);
617 { 609 {
618 head = dup; 610 head = dup;
619 tmp->copy_to (dup); 611 tmp->copy_to (dup);
620 } 612 }
621 613
622 dup->x = op->x + dup->arch->clone.x; 614 dup->x = op->x + dup->arch->x;
623 dup->y = op->y + dup->arch->clone.y; 615 dup->y = op->y + dup->arch->y;
624 dup->map = op->map; 616 dup->map = op->map;
625 617
626 if (head != dup) 618 if (head != dup)
627 { 619 {
628 dup->head = head; 620 dup->head = head;
638 int size_x = 0; 630 int size_x = 0;
639 int size_y = 0; 631 int size_y = 0;
640 632
641 while (check) 633 while (check)
642 { 634 {
643 size_x = MAX (size_x, check->arch->clone.x); 635 size_x = MAX (size_x, check->arch->x);
644 size_y = MAX (size_y, check->arch->clone.y); 636 size_y = MAX (size_y, check->arch->y);
645 check = check->more; 637 check = check->more;
646 } 638 }
647 639
648 if (out_of_map (op->map, head->x + size_x, head->y + size_y)) 640 if (out_of_map (op->map, head->x + size_x, head->y + size_y))
649 { 641 {
675 /* 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
676 * things like rods have nrof 0, we want to cover those. 668 * things like rods have nrof 0, we want to cover those.
677 */ 669 */
678 dm_stack_push (op->contr, head->count); 670 dm_stack_push (op->contr, head->count);
679 671
680 if (at->clone.randomitems != NULL && !at_spell) 672 if (at->randomitems && !at_spell)
681 create_treasure (at->clone.randomitems, head, GT_APPLY, op->map->difficulty, 0); 673 create_treasure (at->randomitems, head, GT_APPLY, op->map->difficulty, 0);
682
683 esrv_send_item (op, head);
684 } 674 }
685 675
686 /* free the one we used to copy */ 676 /* free the one we used to copy */
687 tmp->destroy (); 677 tmp->destroy ();
688 } 678 }
695 */ 685 */
696 686
697int 687int
698command_inventory (object *op, char *params) 688command_inventory (object *op, char *params)
699{ 689{
690 int i;
700 object *tmp; 691 object *tmp;
701 int i;
702 692
703 if (!params) 693 if (!params || !sscanf (params, "%d", &i) || !(tmp = find_object (i)))
704 { 694 {
705 inventory (op, NULL); 695 op->contr->failmsg ("Inventory of what object (nr)?");
706 return 0; 696 return 1;
707 }
708
709 if (!sscanf (params, "%d", &i) || (tmp = find_object (i)) == NULL)
710 { 697 }
711 new_draw_info (NDI_UNIQUE, 0, op, "Inventory of what object (nr)?");
712 return 1;
713 }
714 698
715 inventory (op, tmp); 699 op->contr->infobox (MSG_CHANNEL ("examine"), tmp->query_inventory (op));
700
716 return 1; 701 return 1;
717} 702}
718 703
719/* just show player's their skills for now. Dm's can 704/* just show player's their skills for now. Dm's can
720 * already see skills w/ inventory command - b.t. 705 * already see skills w/ inventory command - b.t.
842 */ 827 */
843int 828int
844command_addexp (object *op, char *params) 829command_addexp (object *op, char *params)
845{ 830{
846 char buf[MAX_BUF], skill[MAX_BUF]; 831 char buf[MAX_BUF], skill[MAX_BUF];
847 int i, q; 832 int q;
833 long long i; // use sint64 and finally provide format specifiers for sint64 etc. via configure
848 object *skillob = NULL; 834 object *skillob = NULL;
849 835
850 skill[0] = '\0'; 836 skill[0] = '\0';
851 if ((params == NULL) || (strlen (params) > MAX_BUF) || ((q = sscanf (params, "%s %d %s", buf, &i, skill)) < 2)) 837 if ((params == NULL) || (strlen (params) > MAX_BUF) || ((q = sscanf (params, "%s %lld %s", buf, &i, skill)) < 2))
852 { 838 {
853 new_draw_info (NDI_UNIQUE, 0, op, "Usage: addexp <who> <how much> [<skill>]."); 839 new_draw_info (NDI_UNIQUE, 0, op, "Usage: addexp <who> <how much> [<skill>].");
854 return 1; 840 return 1;
855 } 841 }
856 842
983command_nowiz (object *op, char *params) 969command_nowiz (object *op, char *params)
984{ /* 'nodm' is alias */ 970{ /* 'nodm' is alias */
985 CLEAR_FLAG (op, FLAG_WIZ); 971 CLEAR_FLAG (op, FLAG_WIZ);
986 CLEAR_FLAG (op, FLAG_WIZPASS); 972 CLEAR_FLAG (op, FLAG_WIZPASS);
987 CLEAR_FLAG (op, FLAG_WIZCAST); 973 CLEAR_FLAG (op, FLAG_WIZCAST);
974 CLEAR_FLAG (op, FLAG_WIZLOOK);
988 975
989 if (op->contr->hidden) 976 if (op->contr->hidden)
990 { 977 {
991 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players"); 978 new_draw_info (NDI_UNIQUE, 0, op, "You are no longer hidden from other players");
992 op->map->players++; 979 op->map->players++;
1057 if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host)) 1044 if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host))
1058 { 1045 {
1059 SET_FLAG (op, FLAG_WIZ); 1046 SET_FLAG (op, FLAG_WIZ);
1060 SET_FLAG (op, FLAG_WIZPASS); 1047 SET_FLAG (op, FLAG_WIZPASS);
1061 SET_FLAG (op, FLAG_WIZCAST); 1048 SET_FLAG (op, FLAG_WIZCAST);
1049 SET_FLAG (op, FLAG_WIZLOOK);
1062 1050
1063 new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!"); 1051 new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!");
1064 /*
1065 * Remove setting flying here - that won't work, because next
1066 * fix_player() is called that will get cleared - proper solution
1067 * is probably something like a wiz_force which gives that and any
1068 * other desired abilities.
1069 */
1070 clear_los (op);
1071 op->contr->write_buf[0] = '\0'; 1052 op->contr->write_buf[0] = '\0';
1072 1053
1073 if (!silent) 1054 if (!silent)
1074 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!"); 1055 new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!");
1075 1056
1124 * name than other "spell_xxx" archetypes and would always conflict. 1105 * name than other "spell_xxx" archetypes and would always conflict.
1125 */ 1106 */
1126static object * 1107static object *
1127get_spell_by_name (object *op, const char *spell_name) 1108get_spell_by_name (object *op, const char *spell_name)
1128{ 1109{
1129 archetype *ar; 1110 archetype *at;
1130 archetype *found; 1111 archetype *found;
1131 int conflict_found; 1112 int conflict_found;
1132 size_t spell_name_length; 1113 size_t spell_name_length;
1133 1114
1134 /* First check for full name matches. */ 1115 /* First check for full name matches. */
1135 conflict_found = 0; 1116 conflict_found = 0;
1136 found = NULL; 1117 found = NULL;
1137 for (ar = first_archetype; ar != NULL; ar = ar->next) 1118 for_all_archetypes (at)
1138 { 1119 {
1139 if (ar->clone.type != SPELL) 1120 if (at->type != SPELL)
1140 continue; 1121 continue;
1141 1122
1142 if (strncmp (ar->name, "spelldirect_", 12) == 0) 1123 if (strncmp (at->archname, "spelldirect_", 12) == 0)
1143 continue; 1124 continue;
1144 1125
1145 if (strcmp (ar->clone.name, spell_name) != 0) 1126 if (strcmp (at->object::name, spell_name) != 0)
1146 continue; 1127 continue;
1147 1128
1148 if (found != NULL) 1129 if (found != NULL)
1149 { 1130 {
1150 if (!conflict_found) 1131 if (!conflict_found)
1151 { 1132 {
1152 conflict_found = 1; 1133 conflict_found = 1;
1153 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one archetype matches the spell name %s:", spell_name); 1134 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one archetype matches the spell name %s:", spell_name);
1154 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->name); 1135 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->archname);
1155 } 1136 }
1137
1156 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &ar->name); 1138 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->archname);
1157 continue; 1139 continue;
1158 } 1140 }
1159 1141
1160 found = ar; 1142 found = at;
1161 } 1143 }
1162 1144
1163 /* No match if more more than one archetype matches. */ 1145 /* No match if more more than one archetype matches. */
1164 if (conflict_found) 1146 if (conflict_found)
1165 return NULL; 1147 return NULL;
1170 1152
1171 /* No full match found: now check for partial matches. */ 1153 /* No full match found: now check for partial matches. */
1172 spell_name_length = strlen (spell_name); 1154 spell_name_length = strlen (spell_name);
1173 conflict_found = 0; 1155 conflict_found = 0;
1174 found = NULL; 1156 found = NULL;
1175 for (ar = first_archetype; ar != NULL; ar = ar->next) 1157 for_all_archetypes (at)
1176 { 1158 {
1177 if (ar->clone.type != SPELL) 1159 if (at->type != SPELL)
1178 continue; 1160 continue;
1179 1161
1180 if (strncmp (ar->name, "spelldirect_", 12) == 0) 1162 if (strncmp (at->archname, "spelldirect_", 12) == 0)
1181 continue; 1163 continue;
1182 1164
1183 if (strncmp (ar->clone.name, spell_name, spell_name_length) != 0) 1165 if (strncmp (at->object::name, spell_name, spell_name_length) != 0)
1184 continue; 1166 continue;
1185 1167
1186 if (found != NULL) 1168 if (found != NULL)
1187 { 1169 {
1188 if (!conflict_found) 1170 if (!conflict_found)
1189 { 1171 {
1190 conflict_found = 1; 1172 conflict_found = 1;
1191 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one spell matches %s:", spell_name); 1173 new_draw_info_format (NDI_UNIQUE, 0, op, "More than one spell matches %s:", spell_name);
1192 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->clone.name); 1174 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &found->object::name);
1193 } 1175 }
1194 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &ar->clone.name); 1176 new_draw_info_format (NDI_UNIQUE, 0, op, "- %s", &at->object::name);
1195 continue; 1177 continue;
1196 } 1178 }
1197 1179
1198 found = ar; 1180 found = at;
1199 } 1181 }
1200 1182
1201 /* No match if more more than one archetype matches. */ 1183 /* No match if more more than one archetype matches. */
1202 if (conflict_found) 1184 if (conflict_found)
1203 return NULL; 1185 return NULL;
1268 new_draw_info_format (NDI_UNIQUE, 0, op, "You do not know the spell %s.", params); 1250 new_draw_info_format (NDI_UNIQUE, 0, op, "You do not know the spell %s.", params);
1269 return 0; 1251 return 0;
1270 } 1252 }
1271 1253
1272 do_forget_spell (op, spell->name); 1254 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; 1255 return 1;
1332} 1256}
1333 1257
1334/** 1258/**
1335 * A players wants to become DM and hide. 1259 * A players wants to become DM and hide.
1656 return 0; 1580 return 0;
1657 } 1581 }
1658 1582
1659 if (!QUERY_FLAG (right, FLAG_REMOVED)) 1583 if (!QUERY_FLAG (right, FLAG_REMOVED))
1660 right->remove (); 1584 right->remove ();
1585
1661 inserted = insert_ob_in_ob (right, left); 1586 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 1587
1668 new_draw_info_format (NDI_UNIQUE, 0, op, "Inserted %s in %s", query_name (inserted), query_name (left)); 1588 new_draw_info_format (NDI_UNIQUE, 0, op, "Inserted %s in %s", query_name (inserted), query_name (left));
1669 1589
1670 return 0; 1590 return 0;
1671 1591

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines