[bpl12] Gain ...

From: Alessandro B. (alexbr@VERSILIA.TOSCANA.IT)
Date: 08/21/98


      Hi ... this is the 1st time I write here ...
I have a problem ... I've write a procedure called Gain .. this block the
autoleveling when a pg reach the xps for the level ... the pg must go to
the guild and type GAIN ...
Now I've write a "Block" to the xp ... a pg can't store xp more than a
level plus 1lev - 1xp unless gaining ...

this is a part of the "block":

void solo_gain(struct char_data * ch, struct char_data * victim)
{
  int exp;

  exp = MIN(max_exp_gain, GET_EXP(victim) / 3);

  /* Calculate level-difference bonus */
  if (IS_NPC(ch))
    exp += MAX(0, (exp * MIN(4, (GET_LEVEL(victim) - GET_LEVEL(ch)))) / 8);
  else
    exp += MAX(0, (exp * MIN(8, (GET_LEVEL(victim) - GET_LEVEL(ch)))) / 8);

  exp = MAX(exp, 1);
--->
  if (GET_LEVEL(ch) >= 51) {
    send_to_char("The immortals don't need xp..\r\n", ch);
    exp = 0; }
  else if (GET_EXP(ch) >= (level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 2) - 1)) {
    send_to_char("You have to gain ...\r\n", ch);
    exp = 0;
  } else {
    if ((GET_EXP(ch) + exp) >= level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 2)) {
      exp = (level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 2) - GET_EXP(ch)) - 1;
      if (exp > 1) {
        sprintf(buf2, "You receive %d experience points.\r\n", exp);
        send_to_char(buf2, ch);
      } else
        send_to_char("You receive one lousy experience point.\r\n", ch);
    } else {
      if (exp > 1) {
        sprintf(buf2, "You receive %d experience points.\r\n", exp);
        send_to_char(buf2, ch);
      } else
        send_to_char("You receive one lousy experience point.\r\n", ch);
    } }
   if ((GET_EXP(ch) + exp) >= level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1)) {
      if (GET_LEVEL(ch) > 50)
         sprintf(buf2, "\r\n");
      else if (GET_EXP(ch) >= level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1))
         sprintf(buf2, "\r\n");
      else {
        sprintf(buf2, "You are ready to pass to level %d.\r\n",
          GET_LEVEL(ch) + 1);
        send_to_char(buf2, ch); }
    }
--->
   gain_exp(ch, exp);
   change_alignment(ch, victim);

}

the code is in perform_group_gain(), solo_gain() & damage() ...
the problem is that when an impl (64lev) or grgod (63lev) fight ... the
core say "SYSERR: requesting exp for invalid level!" ... the mud didn't
crush however ... where is the problem????
Thank for all the help ...

                            Destino

p.s. excuse my terrible english ..... =P


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