do_group code

From: Dennis Haag (Dennis_Haag@byu.edu)
Date: 05/15/94


ACMD(do_group)
{
   struct char_data *victim, *k;
   struct follow_type *f;
   bool found;

   one_argument(argument, buf);

   if (!*buf) {
      if (!IS_AFFECTED(ch, AFF_GROUP)) {
         send_to_char("But you are not the member of a group!\n\r", ch);
      } else {
         send_to_char("Your group consists of:\n\r", ch);

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

         if (IS_AFFECTED(k, AFF_GROUP)) {
            sprintf(buf, "     [%3dH %3dM %2dV] [%2d %s] $N (Head of group)",
                GET_HIT(k), GET_MANA(k), GET_MOVE(k), GET_LEVEL(k), CLASS_ABBR(k
));
            act(buf, FALSE, ch, 0, k, TO_CHAR);
         }

         for (f = k->followers; f; f = f->next)
            if (IS_AFFECTED(f->follower, AFF_GROUP)) {
               sprintf(buf, "     [%3dH %3dM %2dV] [%2d %s] $N",
                   GET_HIT(f->follower), GET_MANA(f->follower),
                   GET_MOVE(f->follower), GET_LEVEL(f->follower),
                   CLASS_ABBR(f->follower));
               act(buf, FALSE, ch, 0, f->follower, TO_CHAR);
            }
      }

      return;
   }

   if (ch->master) {
      act("You can not enroll group members without being head of a group.",
          FALSE, ch, 0, 0, TO_CHAR);
      return;
   }

   if (!str_cmp(buf, "all")) {
      SET_BIT(ch->specials.affected_by, AFF_GROUP);
      for (f = ch->followers; f; f = f->next) {
         victim = f->follower;
         if (!IS_AFFECTED(victim, AFF_GROUP)) {
            act("$N is now a member of your group.", FALSE, ch, 0, victim, TO_CH
AR);
            act("You are now a member of $n's group.", FALSE, ch, 0, victim, TO_
VICT);
            act("$N is now a member of $n's group.", FALSE, ch, 0, victim, TO_NO
TVICT);
            SET_BIT(victim->specials.affected_by, AFF_GROUP);
         }
      }
      return;
   }

   if (!(victim = get_char_room_vis(ch, buf))) {
      send_to_char("No one here by that name.\n\r", ch);
   } else {
      found = FALSE;

      if (victim == ch)
         found = TRUE;
      else {
         for (f = ch->followers; f; f = f->next) {
            if (f->follower == victim) {
               found = TRUE;
               break;
            }
         }
      }

      if (found) {
         if (IS_AFFECTED(victim, AFF_GROUP)) {
            act("$N is no longer a member of your group.", FALSE, ch, 0, victim,
 TO_CHAR);
            act("You have been kicked out of $n's group!", FALSE, ch, 0, victim,
 TO_VICT);
            act("$N has been kicked out of $n's group!", FALSE, ch, 0, victim, T
O_NOTVICT);
            REMOVE_BIT(victim->specials.affected_by, AFF_GROUP);
         } else {
            act("$N is now a member of your group.", FALSE, ch, 0, victim, TO_CH
AR);
            act("You are now a member of $n's group.", FALSE, ch, 0, victim, TO_
VICT);
            act("$N is now a member of $n's group.", FALSE, ch, 0, victim, TO_NO
TVICT);
            SET_BIT(victim->specials.affected_by, AFF_GROUP);
         }
      } else
         act("$N must follow you to enter your group.", FALSE, ch, 0, victim, TO
_CHAR);
   }
}


------------------------------------------------
Dennis Haag, consultant
Student Computing Support Center
Marriot School of Management Computing Support
Brigham Young University
Dennis_Haag@byu.edu, 801 378 4434
------------------------------------------------



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