Re: Consent Command

From: David Cole (tiznor@softhome.net)
Date: 04/30/02


You will need to remove the color codes if your not using this type of color
code or prefer no color. Your choice. I alone did not write this, I received
help from: Deidril: <F.Manisse@cryo-networks.fr>, this code is basically the
group code tweaked to work as  a consent command/system. Have fun with it.

If anyone wants to enlighten me on how to get this on the circle FTP, I will
put it there.

Thanks,
David Cole

Anywhere, place:
void PrintConsent(struct char_data *ch)
{
  struct char_data *k;
  struct consent_type *f;

  send_to_char("&ccConsent Information&cn\r\n", ch);
  send_to_char("&cc-=-=-=-=-=-=-=-=-=-&cn\r\n", ch);

  k = (ch->consenter ? ch->consenter : ch);

  sprintf(buf, "&ccYou are currently consenting: &cC$N&cn");
  act(buf, FALSE, ch, 0, k, TO_CHAR);

  send_to_char("\r\n&ccThe following people have given you their
consent:&cn\r\n", ch);
  for (f = ch->consented; f; f = f->next) {
    sprintf(buf, "&cC$N&cn");
    act(buf, FALSE, ch, 0, f->consented, TO_CHAR);
  }
}


void ClearConsent(struct char_data *ch)
{
  struct char_data * victim;
  struct consent_type *f, *temp;

  victim = ch->consenter;

  if (!victim)
 return;

  for (f = victim->consented; f; f = f->next) {
    if (f->consented == ch ) {
      sprintf(buf2, "&cC%s &ccstops consenting you.&cn\r\n", GET_NAME(ch));
      send_to_char (buf2,victim) ;
      act("&ccYou stop consenting: &cC$N&cc.&cn", FALSE, ch, 0, victim,
TO_CHAR);
      REMOVE_FROM_LIST(f, victim->consented,next);
      break ;
 }
  }
  ch->consenter = NULL;
}


ACMD(do_consent)
{
  struct char_data *vict;
  struct consent_type *f;

  one_argument(argument, buf);

  if (!*buf)
 PrintConsent(ch);
  else if (!(vict = get_char_vis(ch, buf, FIND_CHAR_WORLD)))
     send_to_char(NOPERSON, ch);
  else if (IS_NPC(vict))
  send_to_char(NOPERSON, ch);
  else if (ch->consenter == vict)
  act("You have already given your consent to $M.", FALSE, ch, 0, vict,
TO_CHAR);
  else if (vict == ch) {
    ClearConsent(ch);
    send_to_char ("&ccYou give your consent too yourself.&cn\n\r",ch);
  } else {
    ClearConsent(ch);
    ch->consenter = vict;
    CREATE(f, struct consent_type, 1);
    f->next = vict->consented;
    f->consented = ch;
    vict->consented = f;
    act("&ccYou give your consent too: &cC$N&cc.&cn", FALSE, ch, 0, vict,
TO_CHAR);
    act("&cC$n &cchas given you $s consent.&cn", FALSE, ch, 0, vict,
TO_VICT);
  }
}

in struct.h, above char_data:

struct consent_type {
   struct char_data *consented;
   struct consent_type *next;
};

in char_data, below the *master stuff:
   struct consent_type *consented;       /* List of chars consenting      */
   struct char_data *consenter;          /* Who is char consenting?       */

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT