version 1.20 | | version 1.21 |
---|
| | |
/* | | /* |
* static char *rcsid_c_wiz_c = | | * static char *rcsid_c_wiz_c = |
* "$Id: c_wiz.c,v 1.20 2002/07/15 04:57:13 mwedel Exp $"; | | * "$Id: c_wiz.c,v 1.21 2002/07/18 04:45:35 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
return 1; | | return 1; |
} | | } |
| | |
int command_summon (object *op, char *params) | | |
| | /* Enough of the DM functions seem to need this that I broke |
| | * it out to a seperate function. name is the person |
| | * being saught, rq is who is looking for them. This |
| | * prints diagnostics messages, and returns the |
| | * other player, or NULL otherwise. |
| | */ |
| | static player *get_other_player_from_name(object *op, char *name) |
{ | | { |
int i; | | |
object *dummy; | | |
player *pl; | | player *pl; |
| | |
if (!op) | | if (!name) return NULL; |
return 0; | | |
| | |
if(params==NULL) { | | |
new_draw_info(NDI_UNIQUE, 0,op,"Usage: summon <player>."); | | |
return 1; | | |
} | | |
for(pl=first_player;pl!=NULL;pl=pl->next) | | for(pl=first_player;pl!=NULL;pl=pl->next) |
if(!strncmp(pl->ob->name, params, MAX_NAME)) | | if(!strncmp(pl->ob->name, name, MAX_NAME)) |
break; | | break; |
| | |
if(pl==NULL) { | | if(pl==NULL) { |
new_draw_info(NDI_UNIQUE, 0,op,"No such player."); | | new_draw_info(NDI_UNIQUE, 0,op,"No such player."); |
return 1; | | return NULL; |
} | | } |
| | |
if (pl->ob == op) { | | if (pl->ob == op) { |
new_draw_info(NDI_UNIQUE, 0, op, "You can't summon yourself next to yourself."); | | new_draw_info(NDI_UNIQUE, 0, op, "You can't summon yourself next to yourself."); |
return 1; | | return NULL; |
} | | } |
if(pl->state != ST_PLAYING) { | | if(pl->state != ST_PLAYING) { |
new_draw_info(NDI_UNIQUE, 0,op,"That player can't be summoned right now."); | | new_draw_info(NDI_UNIQUE, 0,op,"That player can't be summoned right now."); |
| | return NULL; |
| | } |
| | return pl; |
| | } |
| | |
| | int command_freeze(object *op, char *params) |
| | { |
| | int ticks; |
| | player *pl; |
| | |
| | if (!params) { |
| | new_draw_info(NDI_UNIQUE, 0,op,"Usage: freeze [ticks] <player>."); |
| | return 1; |
| | } |
| | |
| | ticks = atoi(params); |
| | if (ticks) { |
| | while ((isdigit(*params) || isspace(*params)) && *params != 0) params++; |
| | if (*params == 0) { |
| | new_draw_info(NDI_UNIQUE, 0,op,"Usage: freeze [ticks] <player>."); |
| | return 1; |
| | } |
| | } else ticks=200; |
| | pl = get_other_player_from_name(op, params); |
| | if (!pl) return 1; |
| | new_draw_info(NDI_UNIQUE | NDI_RED, 0, pl->ob, "You have been frozen by the DM!"); |
| | new_draw_info_format(NDI_UNIQUE , 0, op, |
| | "You freeze %s for %d ticks", pl->ob->name, ticks); |
| | pl->ob->speed_left = -(pl->ob->speed * ticks); |
| | return 0; |
| | } |
| | |
| | |
| | int command_summon (object *op, char *params) |
| | { |
| | int i; |
| | object *dummy; |
| | player *pl; |
| | |
| | if (!op) |
| | return 0; |
| | |
| | if(params==NULL) { |
| | new_draw_info(NDI_UNIQUE, 0,op,"Usage: summon <player>."); |
return 1; | | return 1; |
} | | } |
| | |
| | pl = get_other_player_from_name(op, params); |
| | if (!pl) return 1; |
| | |
i=find_free_spot(op->arch,op->map,op->x,op->y,1,8); | | i=find_free_spot(op->arch,op->map,op->x,op->y,1,8); |
if (i==-1) { | | if (i==-1) { |
new_draw_info(NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); | | new_draw_info(NDI_UNIQUE, 0, op, "Can not find a free spot to place summoned player."); |
| | |
free_object(dummy); | | free_object(dummy); |
new_draw_info(NDI_UNIQUE, 0,pl->ob,"You are summoned."); | | new_draw_info(NDI_UNIQUE, 0,pl->ob,"You are summoned."); |
new_draw_info(NDI_UNIQUE, 0,op,"OK."); | | new_draw_info(NDI_UNIQUE, 0,op,"OK."); |
| | |
return 1; | | return 1; |
} | | } |
| | |
/* Teleport next to target player */ | | /* Teleport next to target player */ |
/* mids 01/16/2002 */ | | /* mids 01/16/2002 */ |
| | |
int command_teleport (object *op, char *params) { | | int command_teleport (object *op, char *params) { |
int i; | | int i; |
object *dummy; | | object *dummy; |
| | |
return 1; | | return 1; |
} | | } |
| | |
for (pl = first_player; pl != NULL; pl = pl->next) | | pl = get_other_player_from_name(op, params); |
if (!strncmp(pl->ob->name, params, MAX_NAME)) | | if (!pl) return 1; |
break; | | |
if (pl == NULL) { | | |
new_draw_info(NDI_UNIQUE, 0, op, "No such player."); | | |
return 1; | | |
} | | |
if (pl->ob == op) { | | |
new_draw_info(NDI_UNIQUE, 0, op, "You can't teleport yourself next to yourself."); | | |
return 1; | | |
} | | |
if (pl->state != ST_PLAYING) { | | |
new_draw_info(NDI_UNIQUE, 0, op, "You can't teleport to that player right now."); | | |
return 1; | | |
} | | |
i = find_free_spot(pl->ob->arch, pl->ob->map, pl->ob->x, pl->ob->y, 1, 8); | | i = find_free_spot(pl->ob->arch, pl->ob->map, pl->ob->x, pl->ob->y, 1, 8); |
if (i==-1) { | | if (i==-1) { |
new_draw_info(NDI_UNIQUE, 0, op, "Can not find a free spot to teleport to."); | | new_draw_info(NDI_UNIQUE, 0, op, "Can not find a free spot to teleport to."); |