New Skill (also, attn chris powell)

From: ;P (siv@CYBERENET.NET)
Date: 02/10/98


hey..chris powell..drop me an email so that i can reply with your fixed
olc.c..i accidently deleted your mail..

ObCircle:

here's a new skill for thieves and the like..it allows them to eavesdrop
on an adjacent room..

1 - add a struct char_data *listeners to the room_data struct..
2 - add a struct char_data *next_listener to the char_data struct..
3 - add a sh_int listening_to to the char_data struct..
4 - add in do_eavesdrop (prototyping whatever needs it):

ACMD(do_eavesdrop) {
  int dir;
  one_argument(argument, buf);

  if (!*buf) {
    send_to_char("In which direction would you like to eavesdrop?\r\n", ch);
    return;
  }
  if ((dir = search_block(buf, dirs, FALSE)) < 0) {
    send_to_char("Which directions is that?\r\n", ch);
    return;
  }
  if (!skill_check(ch, SKILL_EAVESDROP)) {
    send_to_char("You try to eavesdrop on that room, but fail.\r\n", ch);
    return;
  }
  if (EXIT(ch, dir)) {
    if (IS_SET(EXIT(ch, dir)->exit_info, EX_CLOSED) && EXIT(ch, dir)->keyword) {
      sprintf(buf, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword));
      send_to_char(buf, ch);
    } else {
      ch->next_listener = world[EXIT(ch, dir)->to_room].listening;
      world[EXIT(ch, dir)->to_room].listening = ch;
      ch->listening_to = EXIT(ch, dir)->to_room;
      send_to_char(OK, ch);
    }
  } else
    send_to_char("There is not a room there...\r\n", ch);
}

5 - change do_eavesdrop to use whatever skill checking method you like..
6 - change send_to_room in comm.c to look like this:

void send_to_room(char *messg, int room)
{
  struct char_data *i;

  if (messg) {
    for (i = world[room].people; i; i = i->next_in_room)
      if (i->desc)
        SEND_TO_Q(messg, i->desc);
    for (i = world[room].listening; i; i = i->next_listener)
      if (i->desc) {
/* the ------'s are used to differentiate eavesdropped stuff from
the stuff that is happening in the same room as the char..
looks like:
-------
john dropped a sword
------
*/
        sprintf(buf, "----------\r\n%s----------\r\n", messg);
        SEND_TO_Q(buf, i->desc);
      }
  }
}

6 - add this command_interpreter in interpreter.c just below the removal
of the HIDE bit..
  if (ch->listening_to) {
    REMOVE_FROM_LIST(ch, world[ch->listening_to].listening, next_listener);
    ch->listening_to = NULL;
  }

that should be all..

siv


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST