[CODE] EXP group stuff

From: Chuck Reed (creed@I-55.COM)
Date: 03/07/98


I finally have my exp functions the way I want them, except one thing.
When a follower kills something (not the grou pleader), he gets all the
exp, but like this

You gain 500 exp!
You gain 500 exp!
You gain 500 exp!

If there were three mebers that is.

HEre's my function for it:

void group_gain(struct char_data * ch, struct char_data * victim)
{
  int tot_members, base;
  struct char_data *k;
  struct follow_type *f;
  int total_levels;

  if (!(k = ch->master))
    k = ch;

  if (IS_AFFECTED(k, AFF_GROUP) && (k->in_room == ch->in_room))
    tot_members = 1;
  else
    tot_members = 0;

  for (f = k->followers; f; f = f->next)
  if (IS_AFFECTED(f->follower, AFF_GROUP) && f->follower->in_room == ch->in_r$
      tot_members++;

  /* round up to the next highest tot_members */
 total_levels = GET_LEVEL(ch);

 for (f = k->followers; f; f = f->next)
    total_levels += GET_LEVEL(f->follower);

 if(IS_AFFECTED(ch, AFF_GROUP)) {
    base = (GET_LEVEL(ch) * GET_EXP(victim))/total_levels;
    perform_group_gain(ch, base, victim);
  }

 for (f = k->followers; f; f = f->next) {
      base = (GET_LEVEL(f->follower) * GET_EXP(victim))/total_levels;
      perform_group_gain(f->follower, base, victim);
  }
}


     +------------------------------------------------------------+
     | 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