[CODE][LONG] Pracs again :)

From: Alaron (digital@together.net)
Date: 02/16/99


Hello, I am severly stuck on this little problem :(, I am trying to make
it so that when you practice a skill it will check to see that you are the
correct level <if it is from your current class>, or if you have already
passed the class that was needed to practice this. The list skills is
perfect thanks to DK, but I cannot seem to get teh practicing part down,
wither it can prac nothing or everything :(.

Here is what i have in spec_procs.c SPECIAL(guild) to check if you can NOT
practice the skill, but it comes back saying that i cannot practice ANY
SKILL.

 if (VIRT_LVL < spell_info[i].min_level[(int) GET_CLASS(ch)]||
      CLASS_SKILL(ch, 1, i) || CLASS_SKILL(ch, 2, i) ||
      CLASS_SKILL(ch, 3, i)) {
    send_to_char("&1Working? You cannot prac this skill&0.\r\n", ch);
    return 1;
  }

and if I make another approach i can practice what i am supposed to in my
current class, but all remort skills can be practiced :(

  if ((VIRT_LVL <
    spell_info[skill_num].min_level[(int)GET_CLASS(ch)]) &&
(GET_LEVEL(ch) < (spell_info[skill_num].min_level[(int)GET_REMORT(ch)]) &&
    spell_info[skill_num].min_level[(int)GET_REMORT_TWO(ch)]) &&
    spell_info[skill_num].min_level[(int)GET_REMORT_THREE(ch)]){
    sprintf(buf, "&1You do not know of that %s.\r\n&0", SPLSKL(ch));
    send_to_char(buf, ch);
    return 1;
  }

I have put the files from spec_procs.c in here in case you needed to
look at any of them.

Thanks in advance
Alaron.








void list_skills(struct char_data * ch)
{
  extern char *spells[];
  extern struct spell_info_type spell_info[];
  int i, sortpos;

  if (!GET_PRACTICES(ch))
    strcpy(buf, "You have no practice sessions remaining.\r\n");
  else
    sprintf(buf, "You have %d practice session%s remaining.\r\n",
            GET_PRACTICES(ch), (GET_PRACTICES(ch) == 1 ? "" : "s"));

  sprintf(buf, "%sYou know of the following %ss:\r\n", buf, SPLSKL(ch));

  strcpy(buf2, buf);

  for (sortpos = 1; sortpos < MAX_SKILLS; sortpos++) {
    i = spell_sort_info[sortpos];
    if (strlen(buf2) >= MAX_STRING_LENGTH - 32) {
      strcat(buf2, "**OVERFLOW**\r\n");
      break;
    }

  #define CLASS(ch, i) \
  ((i) == 0 ? GET_CLASS(ch) : (i) == 1 ? GET_REMORT(ch) : \
  (i) == 2 ? GET_REMORT_TWO(ch) : GET_REMORT_THREE(ch))

  #define HAS_CLASS(ch, i) (CLASS((ch), (i)) != GET_CLASS(ch))

  #define CLASS_SKILL(ch, i, skl) \
  (HAS_CLASS((ch), (i)) && \
  (LVL_IMMORT -1) >= spell_info[(skl)].min_level[CLASS((ch), (i))])


/* new try if statement malcor */
   if (GET_REMORT(ch) == -1){
    if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
      sprintf(buf, "%-20s %s\r\n", spells[i], how_good(GET_SKILL(ch, i)));
      strcat(buf2, buf);
      }
     }
  else if (GET_REMORT_TWO(ch) == -1) {
    if ((GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) ||
      CLASS_SKILL(ch, 1, i)){
      sprintf(buf, "%-20s %s\r\n", spells[i], how_good(GET_SKILL(ch, i)));
      strcat(buf2, buf);
     }
    }
  else if (GET_REMORT_THREE(ch) == -1){
    if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]||
      CLASS_SKILL(ch, 1, i) || CLASS_SKILL(ch, 2, i)){
      sprintf(buf, "%-20s %s\r\n", spells[i], how_good(GET_SKILL(ch, i)));
      strcat(buf2, buf);
     }
    }
  else if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]||
      CLASS_SKILL(ch, 1, i) || CLASS_SKILL(ch, 2, i) ||
      CLASS_SKILL(ch, 3, i)) {
      sprintf(buf, "%-20s %s\r\n", spells[i], how_good(GET_SKILL(ch, i)));
      strcat(buf2, buf);
   }
  }

  page_string(ch->desc, buf2, 1, "");
}


SPECIAL(guild)
{
  int skill_num, percent, VIRT_LVL, i = 0;

  extern struct spell_info_type spell_info[];
  extern struct int_app_type int_app[];

  if (IS_NPC(ch) || !CMD_IS("practice"))
    return 0;

  if (GET_REMORT(ch) == -1)
   VIRT_LVL = GET_LEVEL(ch);
 else if ((GET_REMORT_TWO(ch) == -1) && (GET_REMORT(ch) != -1))
   VIRT_LVL = GET_LEVEL(ch) - 25;
 else {
   VIRT_LVL = GET_LEVEL(ch) - 50;
  }

  skip_spaces(&argument);

  if (!*argument) {
    list_skills(ch);
    return 1;
  }
  if (GET_PRACTICES(ch) <= 0) {
    send_to_char("You do not seem to be able to practice now.\r\n", ch);
    return 1;
  }

  skill_num = find_skill_num(argument);

 /*  Stock circle checking min_level
  if ((skill_num < 1 ||
      GET_LEVEL(ch) < spell_info[skill_num].min_level[(int)
GET_CLASS(ch)])){
*/


// Testing new here, we want to be able to practice all skills that are
// shown with the prac command and not options/


  if (GET_SKILL(ch, skill_num) >= LEARNED(ch)) {
    send_to_char("You are already learned in that area.\r\n", ch);
    return 1;
  }
  send_to_char("You practice for a while...\r\n", ch);
  GET_PRACTICES(ch)--;

  percent = GET_SKILL(ch, skill_num);
  percent += MIN(MAXGAIN(ch), MAX(MINGAIN(ch),
int_app[GET_INT(ch)].learn));

  SET_SKILL(ch, skill_num, MIN(LEARNED(ch), percent));

  if (GET_SKILL(ch, skill_num) >= LEARNED(ch))
    send_to_char("You are now learned in that area.\r\n", ch);

  return 1;
}


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



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