Ejemplo n.º 1
0
/* get a character from anywhere in the world, doesn't care much about
   being in the same room... */
struct char_data *get_char_vis_world(struct char_data *ch, char *name,
				     int *count)
     
{
  struct char_data *i;
  int j, number;
  char tmpname[MAX_INPUT_LENGTH];
  char *tmp;
  
  strcpy(tmpname,name);
  tmp = tmpname;
  if(!(number = get_number(&tmp)))
    return(0);
  
  j = count ? *count : 1;
  for (i = character_list; i && (j <= number); i = i->next)
    if (isname(tmp, GET_NAME(i)))
      if (CAN_SEE(ch, i))	{
	if (j == number)
	  return(i);
	j++;
      }
  if (count) *count = j;
  return 0;
}
Ejemplo n.º 2
0
struct char_data *get_char_room_vis(struct char_data *ch, char *name, int *number)
{
  struct char_data *i;
  int num;

  if (!number) {
    number = &num;
    num = get_number(&name);
  }

  /* JE */
  if (!str_cmp(name, "self") || !str_cmp(name, "me"))
    return (ch);

  /* 0.<name> means PC with name */
  if (*number == 0)
    return (get_player_vis(ch, name, NULL, FIND_CHAR_ROOM));

  for (i = world[IN_ROOM(ch)].people; i && *number; i = i->next_in_room)
    if (isname(name, i->player.name))
      if (CAN_SEE(ch, i))
	if (--(*number) == 0)
	  return (i);

  return (NULL);
}
Ejemplo n.º 3
0
struct char_data *get_char_world_vis(struct char_data *ch, char *name, int *number)
{
  struct char_data *i;
  int num;

  if (!number) {
    number = &num;
    num = get_number(&name);
  }

  if ((i = get_char_room_vis(ch, name, number)) != NULL)
    return (i);

  if (*number == 0)
    return get_player_vis(ch, name, NULL, 0);

  for (i = character_list; i && *number; i = i->next) {
    if (IN_ROOM(ch) == IN_ROOM(i))
      continue;
    if (!isname(name, i->player.name))
      continue;
    if (!CAN_SEE(ch, i))
      continue;
    if (--(*number) != 0)
      continue;

    return (i);
  }
  return (NULL);
}
Ejemplo n.º 4
0
int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr)
{
        if (shop_index[shop_nr].open1>time_info.hours){
                do_say(keeper,
                "Come back later!",17);
                return(FALSE);
        } else if (shop_index[shop_nr].close1<time_info.hours) {
                if (shop_index[shop_nr].open2>time_info.hours){
                        do_say(keeper,
                        "Sorry, we have closed, but come back later.",17);
                        return(FALSE);
                } else if (shop_index[shop_nr].close2<time_info.hours){
                        do_say(keeper,
                        "Sorry, come back tomorrow.",17);
                        return(FALSE);
                };
        }

        if(!(CAN_SEE(keeper,ch)))        {
                do_say(keeper,
                "I don't trade with someone I can't see!",17);
                return(FALSE);
        };

        switch(shop_index[shop_nr].with_who){
                case 0 : return(TRUE);
                case 1 : return(TRUE);
                default : return(TRUE);
        };
}
Ejemplo n.º 5
0
/* Here follows high-level versions of some earlier routines, ie functions
 * which incorporate the actual player-data */
struct char_data *get_player_vis(struct char_data *ch, char *name, int *number, int inroom)
{
  struct char_data *i;
  int num;

  if (!number) {
    number = &num;
    num = get_number(&name);
  }

  for (i = character_list; i; i = i->next) {
    if (IS_NPC(i))
      continue;
    if (inroom == FIND_CHAR_ROOM && IN_ROOM(i) != IN_ROOM(ch))
      continue;
    if (str_cmp(i->player.name, name)) /* If not same, continue */
      continue;
    if (!CAN_SEE(ch, i))
      continue;
    if (--(*number) != 0)
      continue;
    return (i);
  }

  return (NULL);
}
Ejemplo n.º 6
0
int greet_mtrigger(char_data *actor, int dir) {
  trig_data *t = NULL;
  char_data *ch = NULL;
  char buf[MAX_INPUT_LENGTH] = {'\0'};
  int intermediate = 0, final = TRUE;

  if (!valid_dg_target(actor, DG_ALLOW_GODS))
    return TRUE;

  for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) {
    if (!SCRIPT_CHECK(ch, MTRIG_GREET | MTRIG_GREET_ALL) ||
            !AWAKE(ch) || FIGHTING(ch) || (ch == actor) ||
            AFF_FLAGGED(ch, AFF_CHARM))
      continue;

    for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
      if (((IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET) && CAN_SEE(ch, actor)) ||
              IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET_ALL)) &&
              !GET_TRIG_DEPTH(t) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) {
        if (dir >= 0 && dir < DIR_COUNT)
          add_var(&GET_TRIG_VARS(t), "direction", dirs[rev_dir[dir]], 0);
        else
          add_var(&GET_TRIG_VARS(t), "direction", "none", 0);
        ADD_UID_VAR(buf, t, actor, "actor", 0);
        intermediate = script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
        if (!intermediate) final = FALSE;
        continue;
      }
    }
  }
  return final;
}
Ejemplo n.º 7
0
int door_mtrigger(char_data *actor, int subcmd, int dir) {
  trig_data *t;
  char_data *ch;
  char buf[MAX_INPUT_LENGTH];

  for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) {
    if (!SCRIPT_CHECK(ch, MTRIG_DOOR) ||
            !AWAKE(ch) || FIGHTING(ch) || (ch == actor) ||
            AFF_FLAGGED(ch, AFF_CHARM))
      continue;

    for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
      if (IS_SET(GET_TRIG_TYPE(t), MTRIG_DOOR) && CAN_SEE(ch, actor) &&
              !GET_TRIG_DEPTH(t) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) {
        add_var(&GET_TRIG_VARS(t), "cmd", cmd_door[subcmd], 0);
        if (dir >= 0 && dir < DIR_COUNT)
          add_var(&GET_TRIG_VARS(t), "direction", dirs[dir], 0);
        else
          add_var(&GET_TRIG_VARS(t), "direction", "none", 0);
        ADD_UID_VAR(buf, t, actor, "actor", 0);
        return script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
      }
    }
  }
  return 1;
}
Ejemplo n.º 8
0
struct char_data *get_char_vis(struct char_data *ch, char *name)
{
    struct char_data *i;
    int j, number;
  char tmpname[MAX_INPUT_LENGTH];
    char *tmp;

    /* check location */
    if ( ( i = get_char_room_vis(ch, name) ) != 0 )
	return(i);

  strcpy(tmpname,name);
    tmp = tmpname;
    if(!(number = get_number(&tmp)))
	return(0);

    for (i = character_list, j = 1; i && (j <= number); i = i->next)
	if (isname(tmp, GET_NAME(i)))
	    if (CAN_SEE(ch, i)) {
		if (j == number)
		    return(i);
		j++;
	    }

    return(0);
}
Ejemplo n.º 9
0
int
is_ok_char(struct char_data * keeper, struct char_data * ch, int shop_nr)
{
  char buf[200];

  if (!(CAN_SEE(keeper, ch)))
    {
      do_say(keeper, MSG_NO_SEE_CHAR, cmd_say, 0);
      return (FALSE);
    }
  if (IS_GOD(ch))
    return (TRUE);

  if ((IS_GOOD(ch) && NOTRADE_GOOD(shop_nr)) ||
      (IS_EVIL(ch) && NOTRADE_EVIL(shop_nr)) ||
      (IS_NEUTRAL(ch) && NOTRADE_NEUTRAL(shop_nr)))
    {
      sprintf(buf, "%s %s", GET_NAME(ch), MSG_NO_SELL_ALIGN);
      do_tell(keeper, buf, cmd_tell, 0);
      return (FALSE);
    }
  if (IS_NPC(ch))
    return (TRUE);

  if ((IS_MAGIC_USER(ch) && NOTRADE_MAGIC_USER(shop_nr)) ||
      (IS_CLERIC(ch) && NOTRADE_CLERIC(shop_nr)) ||
      (IS_THIEF(ch) && NOTRADE_THIEF(shop_nr)) ||
      (IS_WARRIOR(ch) && NOTRADE_WARRIOR(shop_nr)))
    {
      sprintf(buf, "%s %s", GET_NAME(ch), MSG_NO_SELL_CLASS);
      do_tell(keeper, buf, cmd_tell, 0);
      return (FALSE);
    }
  return (TRUE);
}
Ejemplo n.º 10
0
int greet_mtrigger(char_data *actor, int dir)
{
  trig_data *t;
  char_data *ch;
  char buf[MAX_INPUT_LENGTH];
  int rev_dir[] = { SOUTH, WEST, NORTH, EAST, DOWN, UP };
  int intermediate, final=TRUE;
 
  for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) {
    if (!SCRIPT_CHECK(ch, MTRIG_GREET | MTRIG_GREET_ALL) || 
	!AWAKE(ch) || FIGHTING(ch) || (ch == actor) || 
	AFF_FLAGGED(ch, AFF_CHARM))
      continue;
    
    for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
      if (((IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET) && CAN_SEE(ch, actor)) ||
	   IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET_ALL)) && 
	  !GET_TRIG_DEPTH(t) && (number(1, 100) <= GET_TRIG_NARG(t))) {
        if (dir>=0)
          add_var(&GET_TRIG_VARS(t), "direction", dirs[rev_dir[dir]], 0);
	ADD_UID_VAR(buf, t, actor, "actor", 0);
	intermediate =  script_driver(ch, t, MOB_TRIGGER, TRIG_NEW);
        if (!intermediate) final = FALSE;
	continue;
      }
    }
  }
  return final;
}
Ejemplo n.º 11
0
struct char_data *FindAHatee( struct char_data *ch) 
{
  struct char_data *tmp_ch;

  if (ch->in_room < 0)
    return(0);

  for( tmp_ch=real_roomp(ch->in_room)->people; tmp_ch; 
       tmp_ch = tmp_ch->next_in_room) 
  {
    if (Hates(ch, tmp_ch) && (CAN_SEE(ch, tmp_ch))) 
    {
      if (ch->in_room == tmp_ch->in_room) 
      {
        if (ch != tmp_ch) 
        {
          return(tmp_ch);
        }
        else 
        {
          RemHated(ch,tmp_ch);
          return(0);
        }
      }
    }
  }
  return(0);
}
Ejemplo n.º 12
0
struct char_data *get_char_vis(struct char_data * ch, char *name)
{
  struct char_data *i;
  int j = 0, number;
  char tmpname[MAX_INPUT_LENGTH];
  char *tmp = tmpname;

  /* check the room first */
  if ((i = get_char_vis(ch, name, FIND_CHAR_ROOM)) != NULL)
    return i;

  strcpy(tmp, name);
  if (!(number = get_number(&tmp)))
  {
    number = 1;
    tmp = name;
  }


  for (i = character_list; i && (j <= number); i = i->next)
    if (isname(tmp, i->player.name) && CAN_SEE(ch, i))
      if (++j == number)
	return i;

  return NULL;
}
Ejemplo n.º 13
0
void perform_tell(struct char_data *ch, struct char_data *vict, char *arg)
{
  struct descriptor_data *i;

  send_to_char(CCRED(vict, C_NRM), vict);
  sprintf(buf, "$n tells you, '%s'", arg);
  if (GET_LEVEL(ch) >= LVL_IMMORT)
    sprintf(buf1, "%s tells you, '%s'", CAN_SEE(vict, ch) ? GET_NAME(ch) : "An Immortal", arg);
  else
    sprintf(buf1, "%s tells you, '%s'", CAN_SEE(vict, ch) ? GET_NAME(ch) : "Someone", arg);

  logthistory(buf1, vict);

  act(buf, FALSE, ch, 0, vict, TO_VICT | TO_SLEEP);
  send_to_char(CCNRM(vict, C_NRM), vict);

  if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
    send_to_char(OK, ch);
  else {
    send_to_char(CCRED(ch, C_CMP), ch);
    sprintf(buf, "You tell $N, '%s'", arg);
    if (GET_LEVEL(vict) < LVL_IMMORT)
      sprintf(buf1, "You tell %s, '%s'", CAN_SEE(ch, vict) ? GET_NAME(vict) : "Someone",arg);
    else
      sprintf(buf1, "You tell %s, '%s'", CAN_SEE(ch, vict) ? GET_NAME(vict) : "An Immortal",arg);

    logthistory(buf1, ch);
    act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
    send_to_char(CCNRM(ch, C_CMP), ch);
  }

   for (i = descriptor_list; i; i = i->next)
     if (STATE(i) == CON_PLAYING && i != ch->desc && i != vict->desc &&
       PRF_FLAGGED2(i->character, PRF2_HEARALLTELL) && 
       GET_LEVEL(i->character) == LVL_IMPL && !IS_NPC(ch) && !IS_NPC(vict)) 
       {
    	send_to_char(CCRED(i->character, C_CMP), i->character);
   	sprintf(buf, ">> %s tells %s, '%s'\r\n", GET_NAME(ch), GET_NAME(vict), arg);
	send_to_char(buf, i->character);
        send_to_char(CCNRM(i->character, C_CMP), i->character);
       }
  if (!IS_NPC(vict) && !IS_NPC(ch))
    GET_LAST_TELL(vict) = GET_IDNUM(ch);
}
Ejemplo n.º 14
0
struct char_data *get_char_room_vis(struct char_data * ch, char *name)
{
  struct char_data *i;
  int j = 0, number;
  char tmpname[MAX_INPUT_LENGTH];
  char *tmp = tmpname;

  /* JE 7/18/94 :-) :-) */
  if (!str_cmp(name, "self") || !str_cmp(name, "me"))
    return ch;

  strcpy(tmp, name);
  if (!(number = get_number(&tmp)))
  {
    number = 1;
    tmp = name;
  }


  for (i = world[ch->in_room].people; i && j <= number; i = i->next_in_room) {
 if (PRF_FLAGGED(i, PRF_NOTSELF) && !PRF_FLAGGED(ch, PRF_DETECT) && !IS_NPC(ch)) {
    if (isname(tmp, i->char_specials.name_dis))
      if (CAN_SEE(ch, i))
	if (++j == number)
	  return i;
}
  else if (!IS_APPROVED(i) && !IS_NPC(i)) {
      GET_NAME(i, chname);
        if ((isname(tmp, current_short_desc(i)) || isname(tmp, chname)) && CAN_SEE(ch, i))
          if (++j == number)
            return (i);
      FREE_NAME(chname);
  }

else {
   if (isname(tmp, i->player.name))
      if (CAN_SEE(ch, i))
        if (++j == number)
          return i;
}
}

  return NULL;
}
Ejemplo n.º 15
0
void perform_tell(CHAR_DATA * ch, CHAR_DATA * vict, char *arg)
{
// shapirus: не позволим телять, если жертва не видит и включила
// соответствующий режим; имморталы могут телять всегда
	if (PRF_FLAGGED(vict, PRF_NOINVISTELL)
			&& !CAN_SEE(vict, ch)
			&& GET_LEVEL(ch) < LVL_IMMORT
			&& !PRF_FLAGGED(ch, PRF_CODERINFO))
	{
		act("$N не любит разговаривать с теми, кого не видит.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
		return;
	}

	// TODO: если в act() останется показ иммов, то это и эхо ниже переделать на act()
	if (tell_can_see(ch, vict))
	{
		snprintf(buf, MAX_STRING_LENGTH, "%s сказал%s вам : '%s'", GET_NAME(ch), GET_CH_SUF_1(ch), arg);
	}
	else
	{
		snprintf(buf, MAX_STRING_LENGTH, "Кто-то сказал вам : '%s'", arg);
	}
	snprintf(buf1, MAX_STRING_LENGTH, "%s%s%s\r\n", CCICYN(vict, C_NRM), CAP(buf), CCNRM(vict, C_NRM));
	send_to_char(buf1, vict);
	if (!IS_NPC(vict))
	{
		vict->remember_add(buf1, Remember::ALL);
	}

	if (!IS_NPC(vict) && !IS_NPC(ch))
	{
		snprintf(buf, MAX_STRING_LENGTH, "%s%s : '%s'%s\r\n", CCICYN(ch, C_NRM),
				tell_can_see(ch, vict) ? GET_NAME(ch) : "Кто-то", arg, CCNRM(ch, C_NRM));
		vict->remember_add(buf, Remember::PERSONAL);
	}

	if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
	{
		send_to_char(OK, ch);
	}
	else
	{
		snprintf(buf, MAX_STRING_LENGTH, "%sВы сказали %s : '%s'%s\r\n", CCICYN(ch, C_NRM),
				tell_can_see(vict, ch) ? vict->player_data.PNames[2] : "кому-то", arg, CCNRM(ch, C_NRM));
		send_to_char(buf, ch);
		if (!IS_NPC(ch))
		{
			ch->remember_add(buf, Remember::ALL);
		}
	}

	if (!IS_NPC(vict) && !IS_NPC(ch))
	{
		vict->set_answer_id(GET_IDNUM(ch));
	}
}
Ejemplo n.º 16
0
void list_char_to_char(struct char_data *list, struct char_data *ch,
                       int mode) {
    struct char_data *i;

    for (i = list; i ; i = i->next_in_room) {
        if ( (ch!=i) && (IS_AFFECTED(ch, AFF_SENSE_LIFE) ||
                         (CAN_SEE(ch,i) && !IS_AFFECTED(i, AFF_HIDE))) )
            show_char_to_char(i,ch,0);
    }
}
Ejemplo n.º 17
0
struct char_data *get_char_vis(struct char_data *ch, char *name, int where)
{
  struct char_data *i;
  int j = 0, number;
  char tmpname[MAX_INPUT_LENGTH];
  char *tmp = tmpname;

  /* check the room first */
  if (where == FIND_CHAR_ROOM)
    return get_char_room_vis(ch, name);
  else if (where == FIND_CHAR_WORLD) {
    if ((i = get_char_room_vis(ch, name)) != NULL)
      return (i);

    strcpy(tmp, name);
    if (!(number = get_number(&tmp)))
      return get_player_vis(ch, tmp, 0);

    for (i = character_list; i && (j <= number); i = i->next) {
 if (PRF_FLAGGED(i, PRF_NOTSELF) && !PRF_FLAGGED(ch, PRF_DETECT) && !IS_NPC(ch)) {
     if (isname(tmp, i->char_specials.name_dis) && CAN_SEE(ch, i))
        if (++j == number)
          return (i);
  }
  else if (!IS_APPROVED(i) && !IS_NPC(i)) {
      GET_NAME(i, chname);
        if ((isname(tmp, current_short_desc(i)) || isname(tmp, chname)) && CAN_SEE(ch, i))
          if (++j == number)
            return (i);
      FREE_NAME(chname);
  }

else {
      if (isname(tmp, i->player.name) && CAN_SEE(ch, i))
        if (++j == number)
          return (i);
  }
}
}

  return (NULL);
}
Ejemplo n.º 18
0
int KyussSon( struct char_data *pChar, int nCmd, const char *szArg, 
              struct char_data *pMob, int nType )
{
  struct char_data *pTar;
  struct room_data *pRoom;

  if( pMob == NULL )
  {
    mudlog( LOG_SYSERR, "pMob == NULL in KyussSon( carceri.c )" );
    return FALSE;
  }

  if( nType == EVENT_TICK )
  {
    UpdateList( (CharElem **)&pMob->act_ptr );
    
    if( ( pRoom = real_roomp( pMob->in_room ) ) != NULL )
    {
      struct char_data *pNext;
      for( pTar = pRoom->people; pTar; pTar = pNext )
      {
        pNext = pTar->next_in_room;
        if( CAN_SEE( pTar, pMob ) && 
            !IsInList( (CharElem *)pMob->act_ptr, pTar ) && 
            ( ( IS_PC( pTar ) && 
                !IS_SET( pTar->specials.act, PLR_NOHASSLE ) ) ||
              ( IS_NPC( pTar ) && 
                ( ( pTar->specials.zone != pMob->specials.zone &&
                    !strchr( zone_table[ pTar->specials.zone ].races, 
                             GET_RACE( pTar ) ) ) ||
                  IS_SET( pTar->specials.act, ACT_ANNOYING ) ) ) ) )
        {
          if( !saves_spell( pTar, SAVING_PARA ) )
          {
            act( "Quando vedi $N, sei preso da un incontrollabile panico!",
                 TRUE, pTar, 0, pMob, TO_CHAR );
            do_flee( pTar, "", 0 );
          }
          else
          {
            InsertInList( (CharElem **)&pMob->act_ptr, pTar, 
                          ( SECS_PER_MUD_HOUR * 48 ) / PULSE_MOBILE );
          }
        }
      }
    }
    else
      mudlog( LOG_SYSERR, "pMob in invalid room in KyussSon( carceri.c )" );
  }
  else if( nType == EVENT_DEATH )
    FreeList( (CharElem **)&pMob->act_ptr );
  return FALSE;
}
Ejemplo n.º 19
0
void greet_memory_mtrigger(char_data *actor)
{
  trig_data *t;
  char_data *ch;
  struct script_memory *mem;
  char buf[MAX_INPUT_LENGTH];
  int command_performed = 0;

  for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) {
    if (!SCRIPT_MEM(ch) || !AWAKE(ch) || FIGHTING(ch) || (ch == actor) || 
	AFF_FLAGGED(ch, AFF_CHARM))
      continue;

    /* find memory line with command only */
    for (mem = SCRIPT_MEM(ch); mem && SCRIPT_MEM(ch); mem=mem->next) {
      if (GET_ID(actor)!=mem->id) continue;
      if (mem->cmd) {
        command_interpreter(ch, mem->cmd); /* no script */
        command_performed = 1;
        break;
      }
    }

    /* if a command was not performed execute the memory script */
    if (mem && !command_performed) {
      for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
        if (IS_SET(GET_TRIG_TYPE(t), MTRIG_MEMORY) &&
            CAN_SEE(ch, actor) &&
            !GET_TRIG_DEPTH(t) &&
            number(1, 100) <= GET_TRIG_NARG(t)) {
              ADD_UID_VAR(buf, t, actor, "actor", 0);
              script_driver(ch, t, MOB_TRIGGER, TRIG_NEW);
              break;
        }
      }
    }

    /* delete the memory */
    if (mem) {
      if (SCRIPT_MEM(ch)==mem) {
        SCRIPT_MEM(ch) = mem->next;
      } else {
        struct script_memory *prev;
        prev = SCRIPT_MEM(ch);
        while (prev->next != mem) prev = prev->next;
        prev->next = mem->next;
      }
      if (mem->cmd) free(mem->cmd);
      free(mem);
    }
  }
}
Ejemplo n.º 20
0
int receptionist(struct char_data *ch, int cmd, char *arg)
{
  struct char_data *recep = 0;
  static sh_int action_tabel[9] = {23,24,36,105,106,109,111,142,147};
  
  if (!ch->desc)
    return(FALSE); /* You've forgot FALSE - NPC couldn't leave */
  
  recep=FindMobInRoomWithFunction(ch->in_room,receptionist);
  
  if (!recep) {
    log("No receptionist.\n");
    exit(1);
  }
  
  if (IS_NPC(ch))
    return(FALSE);
  
  if (cmd != 92) {
    if (!number(0, 30))
      do_action(recep, "", action_tabel[number(0,8)]);
    return(FALSE);
  }
  
  if (!AWAKE(recep)) {
    act("$e isn't able to talk to you...", FALSE, recep, 0, ch, TO_VICT);
    return(TRUE);
  }
  if (!CAN_SEE(recep, ch)) 
    {
      act("$n says, 'I don't deal with people I can't see!'", FALSE, recep, 0, 0, TO_ROOM);
      return(TRUE);
    }
  
  if (cmd == 92) { /* Rent  */
    if(count_items(ch) > 150){
      act("$n tells you, 'You have too many items to rent.'", FALSE, recep, 0,
        ch, TO_VICT);
      return(TRUE);
    }
    act("$n stores your stuff in the safe, and helps you into your chamber.", FALSE, recep, 0, ch, TO_VICT);
    act("$n helps $N into $S private chamber.",FALSE, recep,0,ch,TO_NOTVICT);
    rent_char(ch);
    ch->specials.was_in_room=ch->in_room;
    extract_char(ch);
  } else {         /* Offer */
    act("$n tells you - Rent is free... for now...",FALSE,recep,0,ch,TO_VICT);
  }
  
  return(TRUE);
}
Ejemplo n.º 21
0
/*****************************************************************************
  Chiunque veda il Verme della Morte, viene addormentato dal suo sguardo
  ipnotico, a meno con non azzecchi un tiro salvezza contro paralisi.
*****************************************************************************/
int VermeDellaMorte( struct char_data *pChar, int nCmd, const char *szArg, 
                     struct char_data *pMob, int nType )
{
  if( nType == EVENT_TICK && AWAKE( pMob ) )
  {
    struct room_data *pRoom;
    
    if( ( pRoom = real_roomp( pMob->in_room ) ) != NULL )
    {
      struct char_data *pNext, *pTar;
      for( pTar = pRoom->people; pTar; pTar = pNext )
      {
        pNext = pTar->next_in_room;
        if( CAN_SEE( pTar, pMob ) && 
            ( ( IS_PC( pTar ) && 
                !IS_SET( pTar->specials.act, PLR_NOHASSLE ) ) ||
              ( IS_NPC( pTar ) && 
                ( ( pTar->specials.zone != pMob->specials.zone &&
                    !strchr( zone_table[ pTar->specials.zone ].races, 
                             GET_RACE( pTar ) ) ) ||
                  IS_SET( pTar->specials.act, ACT_ANNOYING ) ) ) ) && 
            GET_POS( pTar ) > POSITION_SLEEPING &&
            !IsImmune( pTar, IMM_SLEEP ) )
        {
          if( IsSusc( pTar, IMM_SLEEP ) || 
              ( !saves_spell( pTar, SAVING_PARA ) && 
                ( !IsResist( pTar, IMM_SLEEP ) || 
                  !saves_spell( pTar, SAVING_PARA ) ) ) )
          {
            act( "$N ti guarda fisso. La tua vista si sdoppia.", FALSE,
                 pTar, 0, pMob, TO_CHAR );
            act( "$n cade a terra addormentat$b.", TRUE, pTar, 0, 0, 
                 TO_ROOM );
            if( pTar->specials.fighting )
              stop_fighting( pTar );
            GET_POS( pTar ) = POSITION_SLEEPING;
          }
        }
      }
    }
    else
      mudlog( LOG_SYSERR, 
              "pMob in invalid room in VermeDellaMorte( carceri.c )" );
  }
  return FALSE;
}
Ejemplo n.º 22
0
struct char_data *FindAFearee( struct char_data *ch) 
{
  struct char_data *tmp_ch;

  if (ch->in_room < 0)
    return(0);

  for( tmp_ch=real_roomp(ch->in_room)->people; tmp_ch; 
       tmp_ch = tmp_ch->next_in_room) 
  {
    if (Fears(ch, tmp_ch) && (CAN_SEE(ch, tmp_ch))) 
    {
      if( (ch->in_room == tmp_ch->in_room) && (ch != tmp_ch)) 
      {
        return(tmp_ch);
      }
    }
  }
  return(0);
}
Ejemplo n.º 23
0
struct char_data *get_player_vis(struct char_data * ch, char *name, int inroom)
{
  struct char_data *i;

  for (i = character_list; i; i = i->next) {
   if (PRF_FLAGGED(i, PRF_NOTSELF) && !PRF_FLAGGED(ch, PRF_DETECT) && !IS_NPC(ch)) {
    if (!IS_NPC(i) && (!inroom || i->in_room == ch->in_room) &&
	!str_cmp(i->char_specials.name_dis, name) && CAN_SEE(ch, i))
      return i;
    }

else {
if (!IS_NPC(i) && (!inroom || i->in_room == ch->in_room) &&
    !str_cmp(i->player.name, name)) 

      return i;
}
}
  return NULL;
}
Ejemplo n.º 24
0
int AddHated( struct char_data *ch, struct char_data *pud) 
{
  struct char_list *newpud;

  if (ch == pud)
    return(FALSE);

  if( IS_PC( ch ) )
  { 
    return FALSE;
  }

  if (pud) 
  {
    if (!CAN_SEE(ch, pud))
      return(FALSE);

    CREATE(newpud, struct char_list, 1);
    newpud->op_ch = pud;
    strcpy(newpud->name, GET_NAME(pud));
    newpud->next = ch->hates.clist;
    ch->hates.clist = newpud;
    if (!IS_SET(ch->specials.act, ACT_HATEFUL)) 
      SET_BIT(ch->specials.act, ACT_HATEFUL);
    if (!IS_SET(ch->hatefield, HATE_CHAR)) 
      SET_BIT(ch->hatefield, HATE_CHAR);

    if (pud->in_room != ch->in_room) 
    { 
      /* log("setting hunt because mob was not in same as attacker"); */
      SetHunting(ch,pud);
    }

    if (IS_IMMORTAL(pud))  
    {
      send_to_char("$c0004Qualcuno ti sta odiando.\n\r",pud);
    }      
  } 
  return( (pud) ? TRUE : FALSE );
}
Ejemplo n.º 25
0
struct char_data *get_char_room_vis(struct char_data *ch, char *name)
{
    struct char_data *i;
    int j, number;
  char tmpname[MAX_INPUT_LENGTH];
    char *tmp;

    strcpy(tmpname,name);
    tmp = tmpname;
    if(!(number = get_number(&tmp)))
    return(0);

    for (i = world[ch->in_room].people, j = 1; i && (j <= number); i = i->next_in_room)
	if (isname(tmp, GET_NAME(i)))
	    if (CAN_SEE(ch, i)) {
		if (j == number) 
		    return(i);
		j++;
	    }

    return(0);
}
Ejemplo n.º 26
0
static void npc_steal(struct char_data *ch, struct char_data *victim)
{
  int gold;

  if (IS_NPC(victim))
    return;
  if (GET_LEVEL(victim) >= LVL_IMMORT)
    return;
  if (!CAN_SEE(ch, victim))
    return;

  if (AWAKE(victim) && (rand_number(0, GET_LEVEL(ch)) == 0)) {
    act("You discover that $n has $s hands in your wallet.", FALSE, ch, 0, victim, TO_VICT);
    act("$n tries to steal gold from $N.", TRUE, ch, 0, victim, TO_NOTVICT);
  } else {
    /* Steal some gold coins */
    gold = (GET_GOLD(victim) * rand_number(1, 10)) / 100;
    if (gold > 0) {
      increase_gold(ch, gold);
	  decrease_gold(victim, gold);
    }
  }
}
Ejemplo n.º 27
0
int AddFeared( struct char_data *ch, struct char_data *pud) 
{

  struct char_list *newpud;

  if( IS_PC( ch ) )
  { 
    return FALSE;
  }

  if (pud)
  {

    if (!CAN_SEE(ch, pud))
      return(FALSE);

    CREATE(newpud, struct char_list, 1);
    newpud->op_ch = pud;
    strcpy(newpud->name,GET_NAME(pud));
    newpud->next = ch->fears.clist;
    ch->fears.clist = newpud;
    
    if (!IS_SET(ch->specials.act, ACT_AFRAID))
    {
      SET_BIT(ch->specials.act, ACT_AFRAID);
    }
    if (!IS_SET(ch->fearfield, FEAR_CHAR))
    {
      SET_BIT(ch->fearfield, FEAR_CHAR);
    }
    if (IS_IMMORTAL(pud)) 
      send_to_char("$c0004Qualcuno ti teme (giustamente).\n\r",pud);
  } 
  
  return( (pud) ? TRUE : FALSE);
}
Ejemplo n.º 28
0
void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type[])
{
    char sb[MAX_STRING_LENGTH];
    int i;

    strcpy(sb,"");

    for (i = 0; tokens[i + 1]; i++)
    {
	strcat(sb,tokens[i]);

	switch (type[i])
	{
	case '~':
	    if (!otokens[i])
		strcat(sb,"someone");
	    else if ((char_data *)otokens[i] == ch)
		strcat(sb,"you");
	    else
            {
                GET_PERS((char_data*) otokens[i], ch, chname);
		strcat(sb, chname);
                FREE_NAME(chname);
            }
	    break;

	case '@':
	    if (!otokens[i])
		strcat(sb,"someone's");
	    else if ((char_data *)otokens[i] == ch)
		strcat(sb,"your");
	    else
	    {
                GET_PERS((char_data*) otokens[i], ch, chname);
		strcat(sb, chname);
                FREE_NAME(chname);
		strcat(sb,"'s");
	    }
	    break;

	case '^':
	    if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
		strcat(sb,"its");
	    else if (otokens[i] == ch)
		strcat(sb,"your");
	    else
		strcat(sb,HSHR((char_data *) otokens[i]));
	    break;
		
	case '&':
	    if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
		strcat(sb,"it");
	    else if (otokens[i] == ch)
		strcat(sb,"you");
	    else
		strcat(sb,HSSH((char_data *) otokens[i]));
	    break;
	    
	case '*':
	    if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
		strcat(sb,"it");
	    else if (otokens[i] == ch)
		strcat(sb,"you");
	    else
		strcat(sb,HMHR((char_data *) otokens[i]));
	    break;

	case '`':
	    if (!otokens[i])
		strcat(sb,"something");
	    else
		strcat(sb,OBJS(((obj_data *) otokens[i]), ch));
	    break;
	}
    }

    strcat(sb,tokens[i]);
    strcat(sb,"\n\r");
    sb[0] = toupper(sb[0]);
    send_to_char(sb,ch);
}
Ejemplo n.º 29
0
int gen_receptionist(struct char_data * ch, struct char_data * recep,
			 int cmd, char *arg, int mode)
{
  int cost = 0;
  extern int free_rent;
  sh_int save_room;
  char *action_table[] = {"smile", "dance", "sigh", "blush", "burp",
  "cough", "giggle", "twiddle", "yawn"};

  if (!ch->desc || IS_NPC(ch))
    return FALSE;

  if (!cmd && !number(0, 5)) {
    do_action(recep, "", find_command(action_table[number(0, 8)]), 0);
    return FALSE;
  }
  if (!CMD_IS("offer") && !CMD_IS("rent"))
    return FALSE;
  if (!AWAKE(recep)) {
    send_to_char("She is unable to talk to you...\r\n", ch);
    return TRUE;
  }
  if (!CAN_SEE(recep, ch)) {
    act("$n says, 'I don't deal with people I can't see!'", FALSE, recep, 0, 0, TO_ROOM);
    return TRUE;
  }
  if (free_rent) {
    act("$n tells you, 'Rent is free here.  Just quit, and your objects will be saved!'",
	FALSE, recep, 0, ch, TO_VICT);
    return 1;
  }
  if (CMD_IS("rent")) {
    if (mode == RENT_FACTOR)
      sprintf(buf, "%s Rent will cost you %d gold coins per day.",
			GET_NAME(ch), cost);
    else if (mode == CRYO_FACTOR)
      sprintf(buf, "%s It will cost you %d gold coins to be frozen.",
			GET_NAME(ch), cost);
    do_tell(recep, buf, 0, 0);
    if (cost > GET_GOLD(ch)) {
      sprintf(buf, "%s ...which I see you can't afford.", GET_NAME(ch));
      do_tell(recep, buf, 0, 0);
      return TRUE;
    }
    if (mode == RENT_FACTOR)
      Crash_rent_deadline(ch, recep, cost);

    if (mode == RENT_FACTOR) {
      act("$n stores your belongings and helps you into your private chamber.",
	  FALSE, recep, 0, ch, TO_VICT);
      Crash_rentsave(ch, cost);
      sprintf(buf, "%s has rented (%d/day, %ld tot.)", GET_NAME(ch),
	      cost, GET_GOLD(ch) + GET_BANK_GOLD(ch));
    } else {                    /* cryo */
      act("$n stores your belongings and helps you into your private chamber.\r\n"
	  "A white mist appears in the room, chilling you to the bone...\r\n"
	  "You begin to lose consciousness...",
	  FALSE, recep, 0, ch, TO_VICT);
      Crash_cryosave(ch, cost);
      sprintf(buf, "%s has cryo-rented.", GET_NAME(ch));
      SET_BIT(PLR_FLAGS(ch), PLR_CRYO);
    }

    mudlog(buf, NRM, MAX((int)LVL_IMMORT, (int)GET_INVIS_LEV(ch)), TRUE);
    act("$n helps $N into $S private chamber.", FALSE, recep, 0, ch, TO_NOTVICT);
    save_room = ch->in_room;
    extract_char(ch);
    save_char(ch, save_room);
  } else {
    Crash_offer_rent(ch, recep, TRUE, mode);
    act("$N gives $n an offer.", FALSE, ch, 0, recep, TO_ROOM);
  }
  return TRUE;
}
Ejemplo n.º 30
0
void hunt_aggro(struct char_data * ch)
{
  int dir;
  int skillnum = spells[find_skill_num("aggressive")].spellindex;
  struct char_data *hunted_ch;

  if (!ch || !HUNTING(ch) || FIGHTING(ch)) {
    return;
  }
  /*
   if (world[ch->in_room].zone != world[HUNTING(ch)->in_room].zone) {
   HUNTING(ch) = 0;
   return;
   }
   */
  if ((hunted_ch = find_hunted_char(HUNTING(ch)))) {
    if (ch->in_room == hunted_ch->in_room && !ROOM_FLAGGED(hunted_ch->in_room, ROOM_PEACEFUL)) {
      if (CAN_SEE(hunted_ch, ch) && GET_SKILL(hunted_ch, skillnum) > number(0, 101)) {
        improve_skill(ch, skillnum, SKUSE_AVERAGE);
        hit(hunted_ch, ch, TYPE_UNDEFINED);
      } else {
        if (CAN_SEE(ch, hunted_ch)) {
          hit(ch, hunted_ch, TYPE_UNDEFINED);
        }
      }
      return;
    }
  } else {
    return;
  }

  /* dez 19980805
   if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_SENTINEL)) {
   dir = find_first_step(ch->in_room, hunted_ch->in_room, 2);
   } else if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
   */
  if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) {
    dir = find_first_step(ch->in_room, hunted_ch->in_room, 1);
  } else {
    dir = find_first_step(ch->in_room, hunted_ch->in_room, 0);
  }

  if (dir < 0) {
    /* do not forget until player is dead or I die
     HUNTING(ch) = 0;
     */
    return;
  } else {
    perform_move(ch, dir, 1);
    if (ch->in_room == hunted_ch->in_room) {
      if (!ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL)) {
        if (CAN_SEE(hunted_ch, ch) && GET_SKILL(hunted_ch, skillnum) > number(0, 101)) {
          improve_skill(ch, skillnum, SKUSE_AVERAGE);
          hit(hunted_ch, ch, TYPE_UNDEFINED);
        } else {
          if (CAN_SEE(ch, hunted_ch)) {
            hit(ch, hunted_ch, TYPE_UNDEFINED);
          }
        }
      }
    }
    return;
  }
}