Exemple #1
0
void
perform_net_write(struct descriptor_data *d, char *arg)
{
    char targ[MAX_INPUT_LENGTH];
    char msg[MAX_INPUT_LENGTH];
    struct creature *vict;

    half_chop(arg, targ, msg);

    if (!*targ || !*msg) {
        d_printf(d, "Usage: write <user> <message>\r\n");
        return;
    }

    vict = get_player_vis(d->creature, targ, 1);
    if (!vict)
        vict = get_player_vis(d->creature, targ, 0);

    if (!vict || STATE(vict->desc) != CXN_NETWORK) {
        d_printf(d, "Error: user not logged in\r\n");
        return;
    }

    d_printf(d, "Message sent to %s: %s\r\n", GET_NAME(vict), msg);
    d_printf(vict->desc, "Message from %s: %s\r\n", GET_NAME(d->creature), msg);
}
Exemple #2
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);
}
Exemple #3
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);
}
Exemple #4
0
 /* 
  * Find the char, if not online, load char up. Currently unused. If you can get this to work
  * for you, please send me an update!  Where you get_player_vis in do_clan, substitute this
  * and theoretically you can do anything with the victim offline.
  * Theoretically.  Can also be used in cedit when saving the clan to set leader
  * at clan creation/edit.
  */
 struct char_data *find_clan_char( struct char_data *ch, char *arg )
 {
   struct char_data *vict = NULL, *cbuf = NULL;
 
   if (!(vict = get_player_vis(ch, arg, FIND_CHAR_WORLD))) {
     /* we need to load the file up :( */
    CREATE(cbuf, struct char_data, 1);
     clear_char(cbuf);
     if (load_char(arg, vict) > -1) {
       vict = cbuf;
     }
   }
Exemple #5
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);
}