Re: [Code] Show Percentage Levels for skills/spells

@kirk.geog.sc.edu
Date: 10/18/96


-
:P For all those who asked, below is my code for displaying percentage 
:P levels for skills and spells.  Someone asked a question on how to allow a 
:P person to have both spells and skills, the answer is that Circle really 
:P doesn't differentiate between the two, and you just assign skills to a 
:P spell caster as you would assign spells, in class.c.

this is way old, but only just got around to it.  i was the person who
originally asked about assigning both skills and spells to a class.
since i wanted to let various classes have both, i didn't want it to
display them all in one big list, so i had it break it down into two
lists :) 

in spec_procs.c, i changed the list_skills function, included below.
you will have to add a buf3 declaration in db.h.  probably not the
most elegant way of doing it, but it works :)
it firsts lists all the spells, and then all the skills.


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, "%s\r\nYou know of the following spells:\r\n", buf);
  strcpy(buf2, buf);

  for (sortpos = 1; sortpos <= MAX_SPELLS; sortpos++) {
    i = spell_sort_info[sortpos];
    if (strlen(buf2) >= MAX_STRING_LENGTH - 32) {
      strcat(buf2, "**OVERFLOW**\r\n");
      break;
    }
    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);
    }
  }
  
  sprintf(buf2, "%s\r\nYou know of the following skills:\r\n", buf2);
  strcpy(buf3, buf2);

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

  page_string(ch->desc, buf3, 1);
}

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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