Esempio n. 1
0
void Teleport( int pulse )
{
   struct char_data *ch;
   struct obj_data *obj_object, *temp_obj;
   int or;

   if(DEBUG) dlog("Teleport");
   if (pulse < 0) 
      return;

   if(MOUNTED(ch))
   {
     FallOffMount(ch,MOUNTED(ch));
     Dismount(ch,MOUNTED(ch),POSITION_SITTING);
   }
   else
   if(RIDDEN(ch))
   {
     FallOffMount(RIDDEN(ch),ch);
     Dismount(RIDDEN(ch),ch,POSITION_SITTING);
   }

   for (ch = character_list; ch; ch = ch->next) 
   {
     if (ch->in_room != NOWHERE) 
     {
	if (real_roomp(ch->in_room)->tele_targ > 0) 
	{
           if (real_roomp(ch->in_room)->tele_time > 0) 
	   {
              if ((pulse % real_roomp(ch->in_room)->tele_time)==0) 
	      {
		 obj_object = real_roomp(ch->in_room)->contents;
		 while (obj_object) 
		 {
		   temp_obj = obj_object->next_content;
                   obj_from_room(obj_object);
   	           obj_to_room(obj_object, real_roomp(ch->in_room)->tele_targ);
		   obj_object = temp_obj;
		 }

		 or = ch->in_room;
		 char_from_room(ch); 
		 char_to_room(ch, real_roomp(or)->tele_targ);
       	         if (real_roomp(or)->tele_look) 
		 {
                   do_look(ch, "\0",15);
		 }
	       }
	    }
	 }
      }
   }
}
Esempio n. 2
0
/* Extract a ch completely from the world, and leave his stuff behind */
void extract_char_smarter(struct char_data *ch, int save_room)
{
  struct obj_data *i;
  struct char_data *k, *next_char;
  struct descriptor_data *t_desc;
  int l, was_in, j;

  extern long mob_count;  
  extern struct char_data *combat_list;
  
  void do_save(struct char_data *ch, char *argument, int cmd);
  void do_return(struct char_data *ch, char *argument, int cmd);
  
  void die_follower(struct char_data *ch);

  if(IS_SET(ch->specials.act, ACT_FIGURINE) && ch->link)
     extract_obj(ch->link);
  
  if(!IS_NPC(ch) && !ch->desc)	{
    for(t_desc = descriptor_list; t_desc; t_desc = t_desc->next)
      if(t_desc->original==ch)
	do_return(t_desc->character, "", 0);
  }
  
  if (ch->in_room == NOWHERE) {
    logE("NOWHERE extracting char. (handler.c, extract_char)");
    /*
     **  problem from linkdeath
     */
    char_to_room(ch, 4);  /* 4 == all purpose store */
  }
  
  if (ch->followers || ch->master)
    die_follower(ch);
  
  if(ch->desc) {
    /* Forget snooping */
    if ((ch->desc->snoop.snooping) && (ch->desc->snoop.snooping->desc))
      ch->desc->snoop.snooping->desc->snoop.snoop_by = 0;
    
    if (ch->desc->snoop.snoop_by) {
      send_to_char("Your victim is no longer among us.\n\r",
		   ch->desc->snoop.snoop_by);
      if (ch->desc->snoop.snoop_by->desc)
      ch->desc->snoop.snoop_by->desc->snoop.snooping = 0;
    }
    
    ch->desc->snoop.snooping = ch->desc->snoop.snoop_by = 0;
  }
  
  if (ch->carrying)	{
    /* transfer ch's objects to room */
    
    if (!IS_IMMORTAL(ch)) {

      while(ch->carrying) {
	i=ch->carrying;
	obj_from_char(i);
	obj_to_room(i, ch->in_room);
	check_falling_obj(i, ch->in_room);

      }
    } else {

      send_to_char("Here, you dropped some stuff, let me help you get rid of that.\n\r",ch);

      /*
	equipment too
	*/
      for (j=0; j<MAX_WEAR; j++) {
	if (ch->equipment[j])
	  obj_to_char(unequip_char(ch, j), ch);
      }      

      while (ch->carrying) {
         i = ch->carrying;
	 obj_from_char(i);
	 extract_obj(i);
      }
    }
    
  }
  
  if (ch->specials.fighting)
    stop_fighting(ch);
  
  for (k = combat_list; k ; k = next_char)	{
    next_char = k->next_fighting;
    if (k->specials.fighting == ch)
      stop_fighting(k);
  }

  if (MOUNTED(ch)) {
    Dismount(ch, MOUNTED(ch), POSITION_STANDING);    
  }

  if (RIDDEN(ch)) {
    Dismount(RIDDEN(ch), ch, POSITION_STANDING);
  }
  
  /* Must remove from room before removing the equipment! */
  was_in = ch->in_room;
  char_from_room(ch);
  
  /* clear equipment_list */
  for (l = 0; l < MAX_WEAR; l++)
    if (ch->equipment[l])
      obj_to_room(unequip_char(ch,l), was_in);
  
  
  if (IS_NPC(ch)) {
    for (k=character_list; k; k=k->next) {
      if (k->specials.hunting)
	if (k->specials.hunting == ch) {
	  k->specials.hunting = 0;
	}
      if (Hates(k, ch)) {
	RemHated(k, ch);
      }
      if (Fears(k, ch)) {
	RemFeared(k, ch);
      }
      if (k->orig == ch) {
	k->orig = 0;
      }
    }          
  } else {
    for (k=character_list; k; k=k->next) {
      if (k->specials.hunting)
	if (k->specials.hunting == ch) {
	  k->specials.hunting = 0;
	}
      if (Hates(k, ch)) {
	ZeroHatred(k, ch);
      }
      if (Fears(k, ch)) {
	ZeroFeared(k, ch);
      }
      if (k->orig == ch) {
	k->orig = 0;
      }
    }
    
  }
  /* pull the char from the list */
  
  if (ch == character_list)  
    character_list = ch->next;
  else   {
    for(k = character_list; (k) && (k->next != ch); k = k->next);
    if(k)
      k->next = ch->next;
    else {
      logE("Trying to remove ?? from character_list.(handler.c,extract_char)");
      exit(0);
    }
  }

  if (ch->specials.gname)
    free(ch->specials.gname);
  
  GET_AC(ch) = 100;
  
  if (ch->desc)	{
    if (ch->desc->original)
      do_return(ch, "", 0);
    if (!strcmp(GET_NAME(ch), "Odin's heroic minion")) {
      free(GET_NAME(ch));
      GET_NAME(ch) = strdup("111111");
    }
    save_char(ch, save_room);
  }
  

  t_desc = ch->desc;

  if(ch->term) {
    ScreenOff(ch);
    ch->term = 0;
  }

  if (IS_NPC(ch)) 	{
    if (ch->nr > -1) /* if mobile */
      mob_index[ch->nr].number--;
    FreeHates(ch);
    FreeFears(ch);
    mob_count--;
    free_char(ch);
  }
  
  if (t_desc) {
    t_desc->connected = CON_SLCT;
    SEND_TO_Q(MENU, t_desc);
  }
}
Esempio n. 3
0
void do_mount( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    char buf[MAX_INPUT_LENGTH];
    CHAR_DATA *mount;

    argument = one_argument(argument, arg);

    if (IS_NPC(ch))
	return;

    if (arg[0] == '\0' && ch->mount && ch->mount->in_room == ch->in_room)
    {
	mount = ch->mount;
    }
    else if (!(mount = get_char_room(ch, arg)))
    {
	send_to_char("Mount what?\n\r", ch);
	return;
    }
 
    if (!IS_NPC(ch) && !ch->pcdata->learned[gsn_riding])
    {
	send_to_char("You don't know how to ride!\n\r", ch);
	return;
    } 

    if (!IS_NPC(mount) && !IS_SET(mount->act3, ACT3_MOUNT)) 
    {
	sprintf( buf,"You can't ride that.\n\r"); 
	send_to_char(buf, ch); 
	return;
    }
  
    if (mount->level - 5 > ch->level)
    {
	send_to_char("That beast is too powerful for you to ride.", ch);
	return;
    }    

    if( (mount->mount) && (!mount->riding) && (mount->mount != ch))
    {
	sprintf(buf, "%s belongs to %s, not you.\n\r",
	    mount->short_descr, mount->mount->name);
	send_to_char(buf, ch);
	return;
    } 

    if (mount->position < POS_STANDING)
    {
	send_to_char("Your mount must be standing.\n\r", ch);
	return;
    }

    if (RIDDEN(mount))
    {
	send_to_char("This beast is already ridden.\n\r", ch);
	return;
    }
    else if (MOUNTED(ch))
    {
	send_to_char("You are already riding.\n\r", ch);
	return;
    }

    if( !mount_success(ch, mount, TRUE) )
    {
	send_to_char("You fail to mount the beast.\n\r", ch);  
	return; 
    }

    act("You hop on $N's back.", ch, NULL, mount, TO_CHAR);
    act("$n hops on $N's back.", ch, NULL, mount, TO_NOTVICT);
    act("$n hops on your back!", ch, NULL, mount, TO_VICT);
 
    ch->mount = mount;
    ch->riding = TRUE;
    mount->mount = ch;
    mount->riding = TRUE;

    affect_strip(ch, gsn_sneak);
    REMOVE_BIT(ch->affected_by, AFF_SNEAK);
    affect_strip(ch, gsn_hide);
    REMOVE_BIT(ch->affected_by, AFF_HIDE);
}