Spell/Skill List [by Raven Jade Kenago]
Snippet Posted Wednesday, August 12th @ 11:37:28 PM, by George Greer in the Commands dept.
Added Apr 27, 1998. Click the link below to read it or download it.

From: Raven Jade Kenago <raventhorne@YAHOO.COM>
Subject: new skill/spell list code

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.

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);
}



<< Spell Sphere System [by Christoffer Lundberg] | Reply | View as text | Threaded | Spring Creation Spell [by Chuck Carson] >>

 


Related Links
  CircleMUD
download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.