1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra 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 | * Deliantra 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 |
… | |
… | |
178 | command_kick (object *op, char *params) |
178 | command_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 | } |
… | |
… | |
1051 | if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host)) |
1043 | if (checkdm (op, op->name, (params ? params : "*"), op->contr->ns->host)) |
1052 | { |
1044 | { |
1053 | SET_FLAG (op, FLAG_WIZ); |
1045 | SET_FLAG (op, FLAG_WIZ); |
1054 | SET_FLAG (op, FLAG_WIZPASS); |
1046 | SET_FLAG (op, FLAG_WIZPASS); |
1055 | SET_FLAG (op, FLAG_WIZCAST); |
1047 | SET_FLAG (op, FLAG_WIZCAST); |
|
|
1048 | SET_FLAG (op, FLAG_WIZLOOK); |
1056 | |
1049 | |
1057 | new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!"); |
1050 | new_draw_info (NDI_UNIQUE, 0, op, "Ok, you are the Dungeon Master!"); |
1058 | /* |
|
|
1059 | * Remove setting flying here - that won't work, because next |
|
|
1060 | * fix_player() is called that will get cleared - proper solution |
|
|
1061 | * is probably something like a wiz_force which gives that and any |
|
|
1062 | * other desired abilities. |
|
|
1063 | */ |
|
|
1064 | clear_los (op->contr); |
|
|
1065 | op->contr->write_buf[0] = '\0'; |
1051 | op->contr->write_buf[0] = '\0'; |
1066 | |
1052 | |
1067 | if (!silent) |
1053 | if (!silent) |
1068 | new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!"); |
1054 | new_draw_info (NDI_UNIQUE | NDI_ALL | NDI_LT_GREEN, 1, NULL, "The Dungeon Master has arrived!"); |
1069 | |
1055 | |
… | |
… | |
1593 | return 0; |
1579 | return 0; |
1594 | } |
1580 | } |
1595 | |
1581 | |
1596 | if (!QUERY_FLAG (right, FLAG_REMOVED)) |
1582 | if (!QUERY_FLAG (right, FLAG_REMOVED)) |
1597 | right->remove (); |
1583 | right->remove (); |
|
|
1584 | |
1598 | inserted = insert_ob_in_ob (right, left); |
1585 | insert_ob_in_ob (right, left); |
1599 | if (left->type == PLAYER) |
|
|
1600 | if (inserted == right) |
|
|
1601 | esrv_send_item (left, right); |
|
|
1602 | else |
|
|
1603 | esrv_update_item (UPD_WEIGHT | UPD_NAME | UPD_NROF, left, inserted); |
|
|
1604 | |
1586 | |
1605 | new_draw_info_format (NDI_UNIQUE, 0, op, "Inserted %s in %s", query_name (inserted), query_name (left)); |
1587 | new_draw_info_format (NDI_UNIQUE, 0, op, "Inserted %s in %s", query_name (inserted), query_name (left)); |
1606 | |
1588 | |
1607 | return 0; |
1589 | return 0; |
1608 | |
1590 | |