[CODE][SNIPPET] new skill/spell list code

From: Raven Jade Kenago (raventhorne@YAHOO.COM)
Date: 03/09/98


To use this, replace the list_skills in spec_procs.c with this code. I
took it from some mods I made to
my code and it should work fine on almost any circlemud. Mine is patch
level 12, this is pretty
basic stuff. But it frees all the newbie
implementors of the constant question "How do
I give a class both skills and spells?" This way
they can have both and it will list them properly,
either under the skills list or spells list. In this code it is set up
so that warriors and thieves will not get a spell listing because it
is assumed they have
no spells. All gods will have skill and spell listings
because after immhood class is irrelevant in what
you will know. See the comment in the code for where
to change it to allow/exclude spells to certain classes. Excuse the
poor formatting, this account
pretty much sucks :P

If anyone needs/wants a copy sent as a text file
attachment so you can get it easier, just drop me
a line here and I'll fire one out. Good luck to ya.

Andy

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

  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 skills:\r\n", buf);

  strcpy(buf2, buf);

  for (i = MAX_SPELLS ; i < MAX_SKILLS; i++) {
    if (strlen(buf2) >= MAX_STRING_LENGTH - 32) {
      strcat(buf2, "OVERFLOW in spec_procs.c\r\n");
      break;
    }
    if (GET_LEVEL(ch) >= spell_info[i].min_level[(int)GET_CLASS(ch)]) {
      sprintf(buf, "%-20s %s", spells[i], how_good(GET_SKILL(ch, i)));
      strcat(buf2, buf);
    }
  }
/* Add classes to exclude from the spell listing
here. */
  if ( ( (GET_CLASS(ch) != CLASS_WARRIOR) && (GET_CLASS(ch)
!=CLASS_THIEF) )
      || (GET_LEVEL(ch) >= 51) ) {
  sprintf(buf, "\r\n\r\nAnd the following spells:\r\n");
  strcat(buf2, buf);

  for (i = 1; i < MAX_SPELLS; i++) {
    if (strlen(buf2) >= MAX_STRING_LENGTH - 32) {
      strcat(buf2, "*OVERFLOW in spec_procs.c\r\n");
      break;
    }
    if(GET_LEVEL(ch) >= spell_info[i].min_level[(int)GET_CLASS(ch)]) {
      sprintf(buf, "%-20s %s", spells[i],
      how_good(GET_SKILL(ch, i)));
      strcat(buf2, buf);
    }
 }
}
  page_string(ch->desc, buf2, 1);
}




_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


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