Welcome to the Builder Academy

Question Envy/UltraEnvy Class style system for TBAmud, Snippet to convert

More
Yesterday 19:08 #11094 by wlessard1
I have been working on this one for awhile, probably a few years as the Envy/UltraEnvy class system is, in my opinion much better than Cicrlemud. The data file based system rather than having to put a class in spread through several code files is easier and works quite well. I did use Grok to help make the snippet that I could present here. I am not good a diff and it also helped to make it for 2025 as I am using 2023. 

What this does it this. It gives you warrior.cls, cleric.cls, mage.cls, thief.cls, class.lst
template.cls. Adding a class is as simple as making a new cls file adding skills, setting the variables of mana, move and HP as well as titles and more. No more going through several different code files to do it. Then the
new class after a copyover or reboot is now in your list at creation. No big make clean and make, shutdown and then reboot.
Code:
CLASS FILES SNIPPET for tbaMUD 2025 - edits to stock files       Bramage ========================================================================== This file holds ONLY the changes to existing stock tbaMUD 2025 files.  The new files (src/class_load.c, lib/class/*) are separate files I will have them in a single ZIP, they are warrior.cls, cleric.cls, mage.cls, thief.cls, class.lst template.cls. Adding a class is as simple as making a new cls file adding skills, setting the variables of mana, move and HP as well as titles and more. No more going through several different code files to do it. HOW TO READ THIS FILE   Each file has a  ===== src/file =====  header, then numbered steps in   the order to do them.  Each step says roughly WHERE (function name), then:     Find:              the stock lines to search for, between ---- lines     Add these lines BELOW it: / Add these lines ABOVE it: / CHANGE it to:                        the new code, between ++++ lines   Copy only what is BETWEEN the ---- or ++++ lines.  Tabs are real tabs,   as in stock.  Every new line carries or sits under a "Bramage" comment.   Search for a short piece of the Find text if your copy is not stock.   BIG TABLES IN class.c: a few class.c steps replace a whole function that   is one long table (saving_throws() alone is about 1030 lines).  Those   Find blocks show only the first and last lines, with a line like       [... 1022 more stock lines here - delete them too ...]   in the middle.  Select from the first line shown down to the last line   shown, everything in between included, and replace it all with the   ++++ text.  The count is exact for stock, so you can check you got it. ===== src/db.h ===== Step 1 of 3.  The Mac (#if defined(CIRCLE_MACINTOSH)) LIB_ block near the top - the lines with colons. Find: ---- #define LIB_HOUSE ":house:" ---- Add these lines BELOW it: ++++ #define LIB_CLASS ":class:"   /* Bramage: class files (class_load.c) */ ++++ Step 2 of 3.  The normal LIB_ block right under it - the lines with slashes. Find: ---- #define LIB_PLRFILES    "plrfiles/" ---- Add these lines BELOW it: ++++ #define LIB_CLASS "class/"    /* Bramage: class files (class_load.c) */ ++++ Step 3 of 3.  The list of data files (CONFIG_FILE, PLAYER_FILE, ... TIME_FILE). Find: ---- #define TIME_FILE LIB_ETC"time"    /* for calendar system */ ---- Add these lines BELOW it: ++++ #define CLASS_LIST_FILE LIB_CLASS"class.lst" /* Bramage: class list, order = class number */ ++++ ===== src/db.c ===== Step 1 of 2.  At the top of the file, with the other #includes. Find: ---- #include <sys/stat.h> ---- Add these lines BELOW it: ++++ #include "class.h"   /* Bramage: load_class_files() */ ++++ Step 2 of 2.  boot_db() - right after the spell definitions load, before boot_world(). Find: ----   log("Loading spell definitions.");   mag_assign_spells(); ---- Add these lines BELOW it: ++++   /* Bramage: class data (lib/class/).  Must come after mag_assign_spells()    * so the Skill lines can find spells by name, and before    * init_spell_levels() further down, which uses them.  A bad class file    * stops the boot here with a SYSERR naming the file and line. */   log("Loading class files.");   load_class_files(); ++++ ===== src/class.h ===== Step 1 of 1.  The end of the Global variables list, just above #endif. Find: ---- extern struct guild_info_type guild_info[]; ---- Add these lines BELOW it: ++++ /* Bramage: CLASS DATA FILES. * Everything that used to be a hard-coded table or switch() in class.c now * lives in text files under lib/class/ and is read once at boot by * load_class_files() in class_load.c.  Each class gets one of these structs, * stored in class_table[], indexed by the class number (CLASS_MAGIC_USER = 0, * and so on).  The old functions in class.c (thaco(), title_male(), ...) * keep their names, they just look things up in here now. * * Levels run 0..LVL_IMPL, so the per-level arrays have LVL_IMPL + 1 slots. * Saving throws go higher (MobSave rows), because mobs can be above * LVL_IMPL and magic.c gives every mob the Warrior table. */ #define CLASS_SAVE_TYPES       5   /* PARA, ROD, PETRI, BREATH, SPELL (spells.h) */ #define CLASS_NUM_STATS        6   /* str int wis dex con cha */ #define CLASS_MAX_SAVE_LEVEL 100   /* highest MobSave row; higher = save 100 */ #define CLASS_MAX_STARTEQ     10   /* most StartEq lines in one .cls file */ #define CLASS_MAX_SKILLS     300   /* must be > TOP_SPELL_DEFINE (spells.h); class_load.c checks */ /* Bramage: codes for the "Stats" line, the order the six rolled stats are * handed out in roll_real_abils() (class.c), best roll first. */ #define CSTAT_STR 0 #define CSTAT_INT 1 #define CSTAT_WIS 2 #define CSTAT_DEX 3 #define CSTAT_CON 4 #define CSTAT_CHA 5 struct class_spell_entry {   int spellnum;      /* spell_info[] index, resolved from the name at boot */   int value;         /* level for Skill lines, percent for StartSkill lines */ }; struct class_starteq_entry {   obj_vnum vnum;     /* object to load */   int wear_pos;      /* WEAR_xxx slot to wear it in, -1 = carried ("inv") */ }; struct class_data {   char *name;                        /* "Magic User"   (pc_class_types[])  */   char *abbrev;                      /* "Mu"           (class_abbrevs[])   */   char letter;                       /* 'm'  key typed at the class menu   */   int menu_pos;                      /* order in the creation menu         */   char *menu_text;                   /* "[\t(M\t)]agic-user"              */   int prac_learned, prac_max_gain, prac_min_gain, prac_type; /* prac_params */   int prac_lvl_min, prac_lvl_max;    /* practices gained per level         */   int stat_order[CLASS_NUM_STATS];   /* CSTAT_xxx, best roll first         */   int str_add;                       /* ExceptionalStr yes = 18/xx roll    */   int hp_min, hp_max;                /* advance_level() hit point gain     */   int mana_lo, mana_hi, mana_max;    /* percent of level, percent, cap     */   int move_min, move_max;   int thac0[LVL_IMPL + 1];   int exp[LVL_IMPL + 1];   int saves[CLASS_SAVE_TYPES][CLASS_MAX_SAVE_LEVEL + 1];   char save_set[CLASS_MAX_SAVE_LEVEL + 1];   /* has a Level/MobSave row */   char *title_m[LVL_IMPL + 1];   char *title_f[LVL_IMPL + 1];   int num_skills;                    /* Skill lines -> spell_level()       */   struct class_spell_entry skills[CLASS_MAX_SKILLS];   int num_start_skills;              /* StartSkill lines -> do_start()     */   struct class_spell_entry start_skills[CLASS_MAX_SKILLS];   int num_start_eq;                  /* StartEq lines -> do_start()        */   struct class_starteq_entry start_eq[CLASS_MAX_STARTEQ]; }; extern struct class_data class_table[NUM_CLASSES]; /* Functions available through class_load.c */ void load_class_files(void); ++++ ===== src/class.c ===== Step 1 of 15.  At the top of the file, with the other #includes. Find: ---- #include "class.h" ---- Add these lines BELOW it: ++++ #include "handler.h"   /* Bramage: read_object/equip_char for StartEq lines */ ++++ Step 2 of 15.  The name tables and the class menu, right under the #includes.  Delete all three tables; they are built from the class files now. Find: ---- /* Names first */ const char *class_abbrevs[] = {   "Mu",   "Cl",   "Th",   "Wa",   "\n" }; const char *pc_class_types[] = {   "Magic User",   "Cleric",   "Thief",   "Warrior",   "\n" }; /* The menu for choosing a class in interpreter.c: */ const char *class_menu = "\r\n" "Select a class:\r\n" "  [\t(C\t)]leric\r\n" "  [\t(T\t)]hief\r\n" "  [\t(W\t)]arrior\r\n" "  [\t(M\t)]agic-user\r\n"; ---- CHANGE it to: ++++ /* Bramage: CLASS DATA NOW LIVES IN lib/class/. * The names, abbreviations, class menu, practice settings (prac_params), * guild guard rooms (guild_info), saving throws, THAC0, exp table, titles, * hit/mana/move gains, stat roll order, starting skills, and every class's * spell/skill levels used to be typed right here as C tables and big * switch() statements.  They are now read from one text file per class * (mage.cls, cleric.cls, ...) by class_load.c at boot, into class_table[]. * The functions below keep their old names, so the rest of the MUD calls * them exactly like before; they just look the answer up in class_table. * * class_abbrevs[], pc_class_types[] and class_menu are defined in * class_load.c now, filled from the files. */ ++++ Step 3 of 15.  parse_class() - the whole function, comment included. Find: ---- /* The code to interpret a class letter -- used in interpreter.c when a new * character is selecting a class and by 'set class' in act.wizard.c. */ int parse_class(char arg) {   arg = LOWER(arg);   switch (arg) {   case 'm': return CLASS_MAGIC_USER;   case 'c': return CLASS_CLERIC;   case 'w': return CLASS_WARRIOR;   case 't': return CLASS_THIEF;   default:  return CLASS_UNDEFINED;   } } ---- CHANGE it to: ++++ /* The code to interpret a class letter -- used in interpreter.c when a new * character is selecting a class and by 'set class' in act.wizard.c. * Bramage: the letter comes from each class file's "Letter" line. */ int parse_class(char arg) {   int i;   arg = LOWER(arg);   for (i = 0; i < NUM_CLASSES; i++)     if (class_table[i].letter == arg)       return i;   return CLASS_UNDEFINED; } ++++ Step 4 of 15.  The SPELL/SKILL defines, prac_params[] and guild_info[] (from #define SPELL down to the end of guild_info[]). Find: ---- #define SPELL 0 #define SKILL 1 /* #define LEARNED_LEVEL 0  % known which is considered "learned" */ /* #define MAX_PER_PRAC 1  max percent gain in skill per practice */ /* #define MIN_PER_PRAC 2  min percent gain in skill per practice */ /* #define PRAC_TYPE 3  should it say 'spell' or 'skill'? */ int prac_params[4][NUM_CLASSES] = {   /* MAG CLE THE WAR */   { 95, 95, 85, 80 }, /* learned level */   { 100, 100, 12, 12 }, /* max per practice */   { 25, 25, 0, 0 }, /* min per practice */   { SPELL, SPELL, SKILL, SKILL }, /* prac name */ }; /* The appropriate rooms for each guildmaster/guildguard; controls which types * of people the various guildguards let through.  i.e., the first line shows * that from room 3017, only MAGIC_USERS are allowed to go south. Don't forget * to visit spec_assign.c if you create any new mobiles that should be a guild * master or guard so they can act appropriately. If you "recycle" the * existing mobs that are used in other guilds for your new guild, then you * don't have to change that file, only here. Guildguards are now implemented * via triggers. This code remains as an example. */ struct guild_info_type guild_info[] = { /* Midgaard */ { CLASS_MAGIC_USER,    3017,    SOUTH   }, { CLASS_CLERIC,        3004,    NORTH   }, { CLASS_THIEF,         3027,    EAST   }, { CLASS_WARRIOR,       3021,    EAST   }, /* Brass Dragon */   { -999 /* all */ , 5065, WEST }, /* this must go last -- add new guards above! */   { -1, NOWHERE, -1} }; ---- CHANGE it to: ++++ /* Bramage: the practice settings (prac_params[][]) come from each class * file's "Practice" line, and the guild guard rooms (guild_info[]) from its * "Guild" lines.  Both arrays are defined in class_load.c now. */ ++++ Step 5 of 15.  saving_throws() - the WHOLE function, from its comment down to its closing }. This is the huge one (about 1030 lines).  Delete it all and put the short version in its place. Find: ---- /* Saving throws for : MCTW : PARA, ROD, PETRI, BREATH, SPELL. Levels 0-40. Do * not forget to change extern declaration in magic.c if you add to this. */ byte saving_throws(int class_num, int type, int level) { [... 1022 more stock lines here - delete them too ...]   /* Should not get here unless something is wrong. */   return 100; } ---- CHANGE it to: ++++ /* Saving throws for : PARA, ROD, PETRI, BREATH, SPELL. * Bramage: the numbers come from the "Level" rows (levels 0..LVL_IMPL) and * "MobSave" rows (higher levels, only mobs get there) of each class file. * A level with no row returns 100, as stock did past the end of its table. */ byte saving_throws(int class_num, int type, int level) {   if (class_num < 0 || class_num >= NUM_CLASSES) {     log("SYSERR: Invalid class saving throw.");     return 100;   }   if (type < 0 || type >= CLASS_SAVE_TYPES) {     log("SYSERR: Invalid saving throw type.");     return 100;   }   if (level < 0 || level > CLASS_MAX_SAVE_LEVEL || !class_table[class_num].save_set[level]) {     log("SYSERR: Missing level %d for %s saving throw.", level, pc_class_types[class_num]);     return 100;   }   return (byte) class_table[class_num].saves[type][level]; } ++++ Step 6 of 15.  thaco() - the WHOLE function, from its comment down to its closing }. Find: ---- /* THAC0 for classes and levels.  (To Hit Armor Class 0) */ int thaco(int class_num, int level) {   switch (class_num) { [... 163 more stock lines here - delete them too ...]   /* Will not get there unless something is wrong. */   return 100; } ---- CHANGE it to: ++++ /* THAC0 for classes and levels.  (To Hit Armor Class 0) * Bramage: from the "Level" rows of each class file. */ int thaco(int class_num, int level) {   if (class_num < 0 || class_num >= NUM_CLASSES) {     log("SYSERR: Unknown class in thac0 chart.");     return 100;   }   if (level < 0 || level > LVL_IMPL) {     log("SYSERR: Missing level %d for %s thac0.", level, pc_class_types[class_num]);     return 100;   }   return class_table[class_num].thac0[level]; } ++++ Step 7 of 15.  roll_real_abils() - the switch that hands out the rolls by class. Find: ----   switch (GET_CLASS(ch)) {   case CLASS_MAGIC_USER:     ch->real_abils.intel = table[0];     ch->real_abils.wis = table[1];     ch->real_abils.dex = table[2];     ch->real_abils.str = table[3];     ch->real_abils.con = table[4];     ch->real_abils.cha = table[5];     break;   case CLASS_CLERIC:     ch->real_abils.wis = table[0];     ch->real_abils.intel = table[1];     ch->real_abils.str = table[2];     ch->real_abils.dex = table[3];     ch->real_abils.con = table[4];     ch->real_abils.cha = table[5];     break;   case CLASS_THIEF:     ch->real_abils.dex = table[0];     ch->real_abils.str = table[1];     ch->real_abils.con = table[2];     ch->real_abils.intel = table[3];     ch->real_abils.wis = table[4];     ch->real_abils.cha = table[5];     break;   case CLASS_WARRIOR:     ch->real_abils.str = table[0];     ch->real_abils.dex = table[1];     ch->real_abils.con = table[2];     ch->real_abils.wis = table[3];     ch->real_abils.intel = table[4];     ch->real_abils.cha = table[5];     if (ch->real_abils.str == 18)       ch->real_abils.str_add = rand_number(0, 100);     break;   } ---- CHANGE it to: ++++   /* Bramage: the class file's "Stats" line says which stat gets which    * roll, best roll first.  "ExceptionalStr yes" rolls 18/xx strength when    * strength comes out 18 (stock: warriors only). */   if (GET_CLASS(ch) >= 0 && GET_CLASS(ch) < NUM_CLASSES) {     struct class_data *c = &class_table[(int) GET_CLASS(ch)];     for (i = 0; i < CLASS_NUM_STATS; i++)       switch (c->stat_order[i]) {       case CSTAT_STR: ch->real_abils.str   = table[i]; break;       case CSTAT_INT: ch->real_abils.intel = table[i]; break;       case CSTAT_WIS: ch->real_abils.wis   = table[i]; break;       case CSTAT_DEX: ch->real_abils.dex   = table[i]; break;       case CSTAT_CON: ch->real_abils.con   = table[i]; break;       case CSTAT_CHA: ch->real_abils.cha   = table[i]; break;       }     if (c->str_add && ch->real_abils.str == 18)       ch->real_abils.str_add = rand_number(0, 100);   } ++++ Step 8 of 15.  do_start() - the switch with the thief starting skills. Find: ----   switch (GET_CLASS(ch)) {   case CLASS_MAGIC_USER:     break;   case CLASS_CLERIC:     break;   case CLASS_THIEF:     SET_SKILL(ch, SKILL_SNEAK, 10);     SET_SKILL(ch, SKILL_HIDE, 5);     SET_SKILL(ch, SKILL_STEAL, 15);     SET_SKILL(ch, SKILL_BACKSTAB, 10);     SET_SKILL(ch, SKILL_PICK_LOCK, 10);     SET_SKILL(ch, SKILL_TRACK, 10);     break;   case CLASS_WARRIOR:     break;   } ---- CHANGE it to: ++++   /* Bramage: starting skills come from the class file's "StartSkill"    * lines (stock: only thieves have any).  SET_SKILL sets the percent. */   if (GET_CLASS(ch) >= 0 && GET_CLASS(ch) < NUM_CLASSES) {     struct class_data *c = &class_table[(int) GET_CLASS(ch)];     int i;     for (i = 0; i < c->num_start_skills; i++)       SET_SKILL(ch, c->start_skills[i].spellnum, c->start_skills[i].value);   } ++++ Step 9 of 15.  do_start() - the very end of the function. Find: ----   if (CONFIG_SITEOK_ALL)     SET_BIT_AR(PLR_FLAGS(ch), PLR_SITEOK); } ---- CHANGE it to: ++++   if (CONFIG_SITEOK_ALL)     SET_BIT_AR(PLR_FLAGS(ch), PLR_SITEOK);   /* Bramage: class newbie gear from the class file's "StartEq" lines,    * loaded and worn in the order listed ("inv" = carried).  The stock    * class files have none, so stock starts with no gear, as before.  A    * missing object is logged and skipped; a taken slot goes to inventory. */   if (GET_CLASS(ch) >= 0 && GET_CLASS(ch) < NUM_CLASSES) {     struct class_data *c = &class_table[(int) GET_CLASS(ch)];     struct obj_data *obj;     int i, pos;     for (i = 0; i < c->num_start_eq; i++) {       if (!(obj = read_object(c->start_eq[i].vnum, VIRTUAL))) {         log("SYSERR: StartEq: class %s has no object %d.", c->name, c->start_eq[i].vnum);         continue;       }       pos = c->start_eq[i].wear_pos;       if (pos < 0 || GET_EQ(ch, pos))         obj_to_char(obj, ch);       else         equip_char(ch, obj, pos);     }   } } ++++ Step 10 of 15.  advance_level() - the switch with the hit/mana/move gains. Find: ----   switch (GET_CLASS(ch)) {   case CLASS_MAGIC_USER:     add_hp += rand_number(3, 8);     add_mana = rand_number(GET_LEVEL(ch), (int)(1.5 * GET_LEVEL(ch)));     add_mana = MIN(add_mana, 10);     add_move = rand_number(0, 2);     break;   case CLASS_CLERIC:     add_hp += rand_number(5, 10);     add_mana = rand_number(GET_LEVEL(ch), (int)(1.5 * GET_LEVEL(ch)));     add_mana = MIN(add_mana, 10);     add_move = rand_number(0, 2);     break;   case CLASS_THIEF:     add_hp += rand_number(7, 13);     add_mana = 0;     add_move = rand_number(1, 3);     break;   case CLASS_WARRIOR:     add_hp += rand_number(10, 15);     add_mana = 0;     add_move = rand_number(1, 3);     break;   } ---- CHANGE it to: ++++   /* Bramage: the gains come from the class file:    *   HpGain   <min> <max>     hp   = con bonus + random(min..max)    *   ManaGain <low> <high> <most>    *            mana = random(level * low / 100 .. level * high / 100),    *            but at most <most> (0 = no limit).  "ManaGain 0 0 0" = no    *            mana and no roll.  Stock casters: 100 150 10, which is the    *            old rand_number(level, 1.5 * level), at most 10.    *   MoveGain <min> <max>     move = random(min..max) */   if (GET_CLASS(ch) >= 0 && GET_CLASS(ch) < NUM_CLASSES) {     struct class_data *c = &class_table[(int) GET_CLASS(ch)];     add_hp += rand_number(c->hp_min, c->hp_max);     if (c->mana_lo || c->mana_hi) {       add_mana = rand_number(GET_LEVEL(ch) * c->mana_lo / 100, GET_LEVEL(ch) * c->mana_hi / 100);       if (c->mana_max > 0)         add_mana = MIN(add_mana, c->mana_max);     }     add_move = rand_number(c->move_min, c->move_max);   } ++++ Step 11 of 15.  advance_level() - the practices gained per level. Find: ----   if (IS_MAGIC_USER(ch) || IS_CLERIC(ch))     GET_PRACTICES(ch) += MAX(2, wis_app[GET_WIS(ch)].bonus);   else     GET_PRACTICES(ch) += MIN(2, MAX(1, wis_app[GET_WIS(ch)].bonus)); ---- CHANGE it to: ++++   /* Bramage: "PracPerLvl <min> <max>" in the class file: the wisdom bonus,    * but at least <min> and (if <max> is above 0) at most <max>.  Stock:    * casters 2 0 = MAX(2, bonus), others 1 2 = MIN(2, MAX(1, bonus)). */   if (!IS_NPC(ch) && GET_CLASS(ch) >= 0 && GET_CLASS(ch) < NUM_CLASSES) {     struct class_data *c = &class_table[(int) GET_CLASS(ch)];     int pracs = MAX(c->prac_lvl_min, wis_app[GET_WIS(ch)].bonus);     if (c->prac_lvl_max > 0)       pracs = MIN(c->prac_lvl_max, pracs);     GET_PRACTICES(ch) += pracs;   } else     GET_PRACTICES(ch) += MIN(2, MAX(1, wis_app[GET_WIS(ch)].bonus)); ++++ Step 12 of 15.  init_spell_levels() - the WHOLE function, from its comment down to its closing } (every spell_level() line goes). Find: ---- /* SPELLS AND SKILLS.  This area defines which spells are assigned to which * classes, and the minimum level the character must be to use the spell or * skill. */ void init_spell_levels(void) [... 73 more stock lines here - delete them too ...]   spell_level(SKILL_TRACK, CLASS_WARRIOR, 9);   spell_level(SKILL_BASH, CLASS_WARRIOR, 12);   spell_level(SKILL_WHIRLWIND, CLASS_WARRIOR, 16); } ---- CHANGE it to: ++++ /* SPELLS AND SKILLS.  This area defines which spells are assigned to which * classes, and the minimum level the character must be to use the spell or * skill. * Bramage: the list is the "Skill <level> 'name'" lines in each class file. * The names were already turned into spell numbers when the files loaded. */ void init_spell_levels(void) {   int c, i;   for (c = 0; c < NUM_CLASSES; c++)     for (i = 0; i < class_table[c].num_skills; i++)       spell_level(class_table[c].skills[i].spellnum, c, class_table[c].skills[i].value); } ++++ Step 13 of 15.  level_exp() - the WHOLE function, from its comment down to its closing }. Keep the #define EXP_MAX line just above it. Find: ---- /* Function to return the exp required for each class/level */ int level_exp(int chclass, int level) {   if (level > LVL_IMPL || level < 0) { [... 168 more stock lines here - delete them too ...]    * incomplete. */   log("SYSERR: XP tables not set up correctly in class.c!");   return 123456; } ---- CHANGE it to: ++++ /* Function to return the exp required for each class/level. * Bramage: the last number on each "Level" row of the class file. */ int level_exp(int chclass, int level) {   if (level > LVL_IMPL || level < 0) {     log("SYSERR: Requesting exp for invalid level %d!", level);     return 0;   }   if (chclass < 0 || chclass >= NUM_CLASSES) {     /* Gods have exp close to EXP_MAX (stock rule, kept for odd classes). */     if (level > LVL_IMMORT)       return EXP_MAX - ((LVL_IMPL - level) * 1000);     log("SYSERR: Requesting exp for invalid class %d!", chclass);     return 123456;   }   return class_table[chclass].exp[level]; } ++++ Step 14 of 15.  title_male() - the WHOLE function, from its comment down to its closing }. Find: ---- /* Default titles of male characters. */ const char *title_male(int chclass, int level) {   if (level <= 0 || level > LVL_IMPL) [... 131 more stock lines here - delete them too ...]   /* Default title for classes which do not have titles defined */   return "the Classless"; } ---- CHANGE it to: ++++ /* Default titles of male characters. * Bramage: from the "Title" lines of each class file (male~ female~). */ const char *title_male(int chclass, int level) {   if (level < 0 || level > LVL_IMPL)     return "the Man";   if (chclass < 0 || chclass >= NUM_CLASSES) {     /* Default title for classes which do not have titles defined */     if (level == 0)       return "the Man";     if (level == LVL_IMPL)       return "the Implementor";     return "the Classless";   }   return class_table[chclass].title_m[level]; } ++++ Step 15 of 15.  title_female() - the WHOLE function, from its comment down to its closing } (the last lines of class.c). Find: ---- /* Default titles of female characters. */ const char *title_female(int chclass, int level) {   if (level <= 0 || level > LVL_IMPL) [... 131 more stock lines here - delete them too ...]   /* Default title for classes which do not have titles defined */   return "the Classless"; } ---- CHANGE it to: ++++ /* Default titles of female characters. * Bramage: from the "Title" lines of each class file (male~ female~). */ const char *title_female(int chclass, int level) {   if (level < 0 || level > LVL_IMPL)     return "the Woman";   if (chclass < 0 || chclass >= NUM_CLASSES) {     /* Default title for classes which do not have titles defined */     if (level == 0)       return "the Woman";     if (level == LVL_IMPL)       return "the Implementress";     return "the Classless";   }   return class_table[chclass].title_f[level]; } ++++ ===== END ===== That is all 21 edits in 4 files.  Now rebuild (README.txt, step 4).

Now that you have those changes you need to take this and make a new file called class_load.c and put this code in there. I think I got the header copyright stuff right I hope. 
Code:
/************************************************************************** *  File: class_load.c                                      Part of tbaMUD * *  Usage: Reads the class data files in lib/class/ at boot.               * *                                                                         * *  All rights reserved.  See license for complete information.            * *                                                                         * *  Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * *  CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991.               * *                                                                         * *   Bramage: class data files in the style of the Envy code family (a     * *  Diku derivative, 25+ years old), as used in DungeonWorld (Bramage),    * *  adapted for stock tbaMUD 2025 by Bramage.  Clean C89 / gnu89.          * **************************************************************************/ /* Bramage: HOW THIS FILE WORKS * * At boot, boot_db() (db.c) calls load_class_files() right after the spells * are defined (mag_assign_spells), so spell and skill NAMES can be looked up. * *  1. Read lib/class/class.lst.  Each line is a .cls file name, the list ends *     with a line holding just '$'.  Lines starting with '*' are comments. * *  2. !!! THE ORDER OF class.lst IS THE CLASS NUMBER !!! *     The 1st file is class 0, the 2nd is class 1, and so on.  Player files *     store the class as that NUMBER, so never reorder the list, only add new *     classes at the end.  Each .cls file also has a "Number" line, and we *     check that it matches its place in the list, so a mix-up is caught at *     boot instead of silently turning every mage into a cleric. * *  3. Read each .cls file into class_table[number] (see class.h). * *  4. Copy the bits that older code reads directly (class_abbrevs[], *     pc_class_types[], class_menu, prac_params[][], guild_info[]) out of *     class_table, so the rest of the MUD did not need to change. * * If anything is wrong (missing file, unknown keyword, unknown spell name, * missing level row...) we log a SYSERR saying exactly which file and line, * and exit(1).  Refusing to boot is much better than running with garbage * class data and quietly breaking player files. * * ADDING A NEW CLASS (recipe): *   a) structs.h: add  #define CLASS_NEWONE  4  and bump NUM_CLASSES to 5. *   b) copy lib/class/template.cls to newone.cls, edit it, set "Number 4". *   c) add its file name to the END of lib/class/class.lst (before the '$'). *   d) only if the class needs special code (IS_NEWONE() macro, ITEM_ANTI_ *      flag, special attacks...), add that code too. *   e) make clean; make; full reboot. */ #include "conf.h" #include "sysdep.h" #include "structs.h" #include "utils.h" #include "db.h" #include "spells.h" #include "interpreter.h" #include "constants.h" #include "class.h" /* Bramage: a "compile time assert".  If TOP_SPELL_DEFINE ever grows past * CLASS_MAX_SKILLS, the array below gets size -1 and gcc refuses to compile, * telling you to raise CLASS_MAX_SKILLS in class.h. */ typedef char class_max_skills_too_small[(TOP_SPELL_DEFINE < CLASS_MAX_SKILLS) ? 1 : -1]; /* The loaded data.  Everything in class.c reads from here. */ struct class_data class_table[NUM_CLASSES]; /* Bramage: these used to be typed out in class.c.  They are filled from * class_table so old code (sprinttype, search_block, CLASS_ABBR) keeps * working.  The "\n" at the end is the usual tbaMUD list terminator. */ const char *class_abbrevs[NUM_CLASSES + 1]; const char *pc_class_types[NUM_CLASSES + 1]; const char *class_menu = ""; /* prac_params[row][class], rows as used by spec_procs.c: * 0 learned level, 1 max per practice, 2 min per practice, 3 spell/skill. */ int prac_params[4][NUM_CLASSES]; /* Bramage: guild guard rooms.  Each class file can have "Guild <room> <dir>" * lines.  Guards that block EVERY class (pc_class -999) aren't tied to one * class, so they stay here in code (this is the stock Brass Dragon entry). * These are only used by the old guild_guard spec proc; stock tbaMUD does * most guards with DG triggers nowadays. */ static const struct guild_info_type all_class_guards[] = {   { -999 /* all */ , 5065, WEST },   /* Brass Dragon */   { -1, NOWHERE, -1 }                /* end marker, keep last */ }; #define MAX_GUILD_ENTRIES 100 struct guild_info_type guild_info[MAX_GUILD_ENTRIES + 1]; /* Bramage: names you can use on a StartEq line, in stock WEAR_xxx order * (structs.h).  If you add a wear slot in structs.h, add its name here too * (the size check below fails to compile if the count is off).  "inv" is * also accepted on a StartEq line: carried, not worn. */ static const char *wear_names[] = {   "light", "finger_r", "finger_l", "neck_1", "neck_2", "body", "head",   "legs", "feet", "hands", "arms", "shield", "about", "waist", "wrist_r",   "wrist_l", "wield", "hold" }; typedef char wear_names_match_NUM_WEARS[(sizeof(wear_names) / sizeof(wear_names[0]) == NUM_WEARS) ? 1 : -1]; static const char *stat_names[CLASS_NUM_STATS] = { "str", "int", "wis", "dex", "con", "cha" }; /* ---------- small helpers ---------- */ /* Bramage: which file/line we're on, so every error message can say it. */ static const char *cur_file = ""; static int cur_line = 0; /* Bramage: log the problem and stop the boot.  The "..." and va_list let * this work like printf: class_fail("bad level %d", lvl). */ static void class_fail(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); static void class_fail(const char *fmt, ...) {   char buf[MAX_STRING_LENGTH];   va_list args;   va_start(args, fmt);   vsnprintf(buf, sizeof(buf), fmt, args);   va_end(args);   if (cur_line > 0)     log("SYSERR: Class file %s, line %d: %s", cur_file, cur_line, buf);   else     log("SYSERR: Class file %s: %s", cur_file, buf);   log("SYSERR: Fix the class files in %s and reboot.  Shutting down.", LIB_CLASS);   exit(1); } /* Read one line, strip the newline (and the \r a Windows editor adds). * Returns FALSE at end of file. */ static int class_get_line(FILE *fl, char *buf, size_t size) {   size_t len;   if (!fgets(buf, size, fl))     return FALSE;   cur_line++;   len = strlen(buf);   while (len > 0 && (buf[len - 1] == '\n' || buf[len - 1] == '\r'))     buf[--len] = '\0';   return TRUE; } /* Bramage: read text up to a '~' (the classic Diku string end marker). * *pp points into the line; afterwards it points just past the '~'. * "\t" typed as two characters becomes a real tab, which is tbaMUD's color * code escape, so [\t(M\t)] in the file shows a highlighted M in the menu. */ static char *class_read_tilde(char **pp) {   char out[MAX_INPUT_LENGTH];   char *p = *pp;   size_t n = 0;   skip_spaces(&p);   while (*p && *p != '~') {     if (*p == '\\' && *(p + 1) == 't') {       if (n < sizeof(out) - 1) out[n++] = '\t';       p += 2;       continue;     }     if (n < sizeof(out) - 1) out[n++] = *p;     p++;   }   if (*p != '~')     class_fail("text is missing its closing '~'");   out[n] = '\0';   *pp = p + 1;   return strdup(out); } /* Read a whole number, or stop the boot if there isn't one. */ static int class_read_int(char **pp, const char *what) {   char *end;   long val;   skip_spaces(pp);   val = strtol(*pp, &end, 10);   if (end == *pp)     class_fail("expected a number for %s", what);   *pp = end;   return (int) val; } /* Read one plain word (no spaces) into buf. */ static void class_read_word(char **pp, char *buf, size_t size, const char *what) {   size_t n = 0;   skip_spaces(pp);   while (**pp && !isspace(**pp)) {     if (n < size - 1) buf[n++] = **pp;     (*pp)++;   }   buf[n] = '\0';   if (!n)     class_fail("expected a word for %s", what); } /* Bramage: nothing but spaces may follow the last value on a line, so a * typo such as an extra number is caught instead of silently ignored. */ static void class_line_done(char *p) {   skip_spaces(&p);   if (*p)     class_fail("unexpected text at the end of the line: '%s'", p); } /* Bramage: turn 'magic missile' into SPELL_MAGIC_MISSILE's number by * looking through spell_info[] for that exact name (not case sensitive). * We use an EXACT match, not an abbreviation, so 'armor' can never land on * some other spell that merely starts with those letters.  If a name ever * matches more than one spell we stop and say so; write #<number> instead * of 'name' in that case, e.g.  Skill 30 #9 */ static int class_read_spell(char **pp) {   char name[MAX_INPUT_LENGTH];   char *p = *pp;   size_t n = 0;   int i, found = -1;   skip_spaces(&p);   if (*p == '#') {     p++;     i = class_read_int(&p, "spell number");     if (i < 1 || i > TOP_SPELL_DEFINE || !spell_info[i].name ||         !str_cmp(spell_info[i].name, "!UNUSED!"))       class_fail("there is no spell/skill number %d", i);     *pp = p;     return i;   }   if (*p != '\'')     class_fail("spell/skill name must be in 'single quotes'");   p++;   while (*p && *p != '\'') {     if (n < sizeof(name) - 1) name[n++] = *p;     p++;   }   if (*p != '\'')     class_fail("spell/skill name is missing its closing quote");   name[n] = '\0';   *pp = p + 1;   for (i = 1; i <= TOP_SPELL_DEFINE; i++) {     if (!spell_info[i].name || str_cmp(spell_info[i].name, name))       continue;     if (found != -1)       class_fail("'%s' is the name of two spells (#%d and #%d); use #<number> instead", name, found, i);     found = i;   }   if (found == -1)     class_fail("unknown spell/skill '%s' (check the spelling against spell_parser.c)", name);   return found; } /* ---------- one .cls file ---------- */ /* Bramage: bit flags so we can tell, at the end of a file, which required * keywords never showed up. */ #define SEEN_NUMBER   (1 << 0) #define SEEN_NAME     (1 << 1) #define SEEN_ABBREV   (1 << 2) #define SEEN_LETTER   (1 << 3) #define SEEN_MENU     (1 << 4) #define SEEN_PRAC     (1 << 5) #define SEEN_PRACLVL  (1 << 6) #define SEEN_STATS    (1 << 7) #define SEEN_HP       (1 << 8) #define SEEN_MANA     (1 << 9) #define SEEN_MOVE     (1 << 10) #define SEEN_ALL      ((1 << 11) - 1) static void load_one_class(const char *filename, int cnum) {   char path[PATH_MAX], line[MAX_STRING_LENGTH], key[MAX_INPUT_LENGTH], word[MAX_INPUT_LENGTH];   char lvl_seen[LVL_IMPL + 1], ttl_seen[LVL_IMPL + 1];   struct class_data *c = &class_table[cnum];   int seen = 0, done = FALSE, i, j, lvl;   char *p;   FILE *fl;   snprintf(path, sizeof(path), "%s%s", LIB_CLASS, filename);   cur_file = path;   cur_line = 0;   if (!(fl = fopen(path, "r")))     class_fail("can't open the file (is it listed in class.lst but missing?)");   memset(c, 0, sizeof(*c));   memset(lvl_seen, 0, sizeof(lvl_seen));   memset(ttl_seen, 0, sizeof(ttl_seen));   while (!done && class_get_line(fl, line, sizeof(line))) {     p = line;     skip_spaces(&p);     if (!*p || *p == '*')      /* blank line or comment */       continue;     class_read_word(&p, key, sizeof(key), "keyword");     if (!str_cmp(key, "End")) {       done = TRUE;     } else if (!str_cmp(key, "Number")) {       i = class_read_int(&p, "Number");       if (i != cnum)         class_fail("says Number %d, but it is entry %d in class.lst.  The list order IS the class number; fix one or the other", i, cnum);       seen |= SEEN_NUMBER;     } else if (!str_cmp(key, "Name")) {       c->name = class_read_tilde(&p);       if (!*c->name)         class_fail("Name is empty");       seen |= SEEN_NAME;     } else if (!str_cmp(key, "Abbrev")) {       c->abbrev = class_read_tilde(&p);       seen |= SEEN_ABBREV;     } else if (!str_cmp(key, "Letter")) {       class_read_word(&p, word, sizeof(word), "Letter");       if (strlen(word) != 1 || !isalpha(*word))         class_fail("Letter must be one letter, not '%s'", word);       c->letter = LOWER(*word);       seen |= SEEN_LETTER;     } else if (!str_cmp(key, "Menu")) {       c->menu_pos = class_read_int(&p, "Menu position");       c->menu_text = class_read_tilde(&p);       seen |= SEEN_MENU;     } else if (!str_cmp(key, "Practice")) {       c->prac_learned  = class_read_int(&p, "Practice learned");       c->prac_max_gain = class_read_int(&p, "Practice max gain");       c->prac_min_gain = class_read_int(&p, "Practice min gain");       class_read_word(&p, word, sizeof(word), "Practice spell/skill");       if (!str_cmp(word, "spell"))      c->prac_type = 0;       else if (!str_cmp(word, "skill")) c->prac_type = 1;       else class_fail("last Practice value must be spell or skill, not '%s'", word);       seen |= SEEN_PRAC;     } else if (!str_cmp(key, "PracPerLvl")) {       c->prac_lvl_min = class_read_int(&p, "PracPerLvl min");       c->prac_lvl_max = class_read_int(&p, "PracPerLvl max");       seen |= SEEN_PRACLVL;     } else if (!str_cmp(key, "Stats")) {       int used = 0;       for (i = 0; i < CLASS_NUM_STATS; i++) {         class_read_word(&p, word, sizeof(word), "Stats");         for (j = 0; j < CLASS_NUM_STATS; j++)           if (!str_cmp(word, stat_names[j]))             break;         if (j == CLASS_NUM_STATS)           class_fail("unknown stat '%s' (use str int wis dex con cha)", word);         if (used & (1 << j))           class_fail("stat '%s' is listed twice on the Stats line", word);         used |= (1 << j);         c->stat_order[i] = j;       }       seen |= SEEN_STATS;     } else if (!str_cmp(key, "ExceptionalStr")) {       /* Bramage: optional, default no.  Only yes/no, so a typo fails. */       class_read_word(&p, word, sizeof(word), "ExceptionalStr");       if (!str_cmp(word, "yes"))         c->str_add = 1;       else if (!str_cmp(word, "no"))         c->str_add = 0;       else         class_fail("ExceptionalStr must be yes or no, not '%s'", word);     } else if (!str_cmp(key, "HpGain")) {       c->hp_min = class_read_int(&p, "HpGain min");       c->hp_max = class_read_int(&p, "HpGain max");       seen |= SEEN_HP;     } else if (!str_cmp(key, "ManaGain")) {       c->mana_lo  = class_read_int(&p, "ManaGain low percent");       c->mana_hi  = class_read_int(&p, "ManaGain high percent");       c->mana_max = class_read_int(&p, "ManaGain most");       if (c->mana_lo < 0 || c->mana_hi < 0 || c->mana_max < 0)         class_fail("ManaGain values can't be negative");       seen |= SEEN_MANA;     } else if (!str_cmp(key, "MoveGain")) {       c->move_min = class_read_int(&p, "MoveGain min");       c->move_max = class_read_int(&p, "MoveGain max");       seen |= SEEN_MOVE;     } else if (!str_cmp(key, "Guild")) {       for (i = 0; guild_info[i].guild_room != NOWHERE; i++)         ;       if (i >= MAX_GUILD_ENTRIES - 1)         class_fail("too many Guild lines in total (max %d)", MAX_GUILD_ENTRIES - 1);       j = class_read_int(&p, "Guild room");       if (j < 0 || j >= IDXTYPE_MAX)         class_fail("Guild room %d is not a room vnum (0..%d)", j, IDXTYPE_MAX - 1);       guild_info[i].pc_class = cnum;       guild_info[i].guild_room = j;       class_read_word(&p, word, sizeof(word), "Guild direction");       for (j = 0; *dirs[j] != '\n'; j++)         if (!str_cmp(word, dirs[j]))           break;       if (*dirs[j] == '\n')         class_fail("unknown Guild direction '%s'", word);       guild_info[i].direction = j;       guild_info[i + 1].guild_room = NOWHERE;   /* keep the end marker */       guild_info[i + 1].pc_class = -1;       guild_info[i + 1].direction = -1;     } else if (!str_cmp(key, "Skill")) {       lvl = class_read_int(&p, "Skill level");       if (lvl < 1 || lvl > LVL_IMPL)         class_fail("Skill level %d is outside 1..%d", lvl, LVL_IMPL);       if (c->num_skills >= CLASS_MAX_SKILLS)         class_fail("too many Skill lines");       c->skills[c->num_skills].value = lvl;       c->skills[c->num_skills].spellnum = class_read_spell(&p);       c->num_skills++;     } else if (!str_cmp(key, "StartSkill")) {       if (c->num_start_skills >= CLASS_MAX_SKILLS)         class_fail("too many StartSkill lines");       i = class_read_int(&p, "StartSkill percent");       if (i < 1 || i > 100)         class_fail("StartSkill percent must be 1..100, not %d", i);       c->start_skills[c->num_start_skills].value = i;       c->start_skills[c->num_start_skills].spellnum = class_read_spell(&p);       c->num_start_skills++;     } else if (!str_cmp(key, "StartEq")) {       if (c->num_start_eq >= CLASS_MAX_STARTEQ)         class_fail("too many StartEq lines (max %d)", CLASS_MAX_STARTEQ);       j = class_read_int(&p, "StartEq vnum");       if (j < 0 || j >= IDXTYPE_MAX)         class_fail("StartEq vnum %d is not an object vnum (0..%d)", j, IDXTYPE_MAX - 1);       c->start_eq[c->num_start_eq].vnum = j;       class_read_word(&p, word, sizeof(word), "StartEq wear slot");       if (!str_cmp(word, "inv"))         j = -1;       else {         for (j = 0; j < NUM_WEARS; j++)           if (!str_cmp(word, wear_names[j]))             break;         if (j == NUM_WEARS)           class_fail("unknown StartEq wear slot '%s'", word);       }       c->start_eq[c->num_start_eq].wear_pos = j;       c->num_start_eq++;     } else if (!str_cmp(key, "Level")) {       lvl = class_read_int(&p, "Level");       if (lvl < 0 || lvl > LVL_IMPL)         class_fail("Level %d is outside 0..%d (use MobSave for higher levels)", lvl, LVL_IMPL);       if (lvl_seen[lvl])         class_fail("Level %d is listed twice", lvl);       lvl_seen[lvl] = 1;       c->thac0[lvl] = class_read_int(&p, "thac0");       for (i = 0; i < CLASS_SAVE_TYPES; i++)         c->saves[i][lvl] = class_read_int(&p, "saving throw");       c->exp[lvl] = class_read_int(&p, "exp");       c->save_set[lvl] = 1;     } else if (!str_cmp(key, "MobSave")) {       lvl = class_read_int(&p, "MobSave level");       if (lvl <= LVL_IMPL || lvl > CLASS_MAX_SAVE_LEVEL)         class_fail("MobSave level %d is outside %d..%d (levels 0..%d go on Level rows)", lvl, LVL_IMPL + 1, CLASS_MAX_SAVE_LEVEL, LVL_IMPL);       if (c->save_set[lvl])         class_fail("MobSave %d is listed twice", lvl);       for (i = 0; i < CLASS_SAVE_TYPES; i++)         c->saves[i][lvl] = class_read_int(&p, "saving throw");       c->save_set[lvl] = 1;     } else if (!str_cmp(key, "Title")) {       lvl = class_read_int(&p, "Title level");       if (lvl < 0 || lvl > LVL_IMPL)         class_fail("Title level %d is outside 0..%d", lvl, LVL_IMPL);       if (ttl_seen[lvl])         class_fail("Title %d is listed twice", lvl);       ttl_seen[lvl] = 1;       c->title_m[lvl] = class_read_tilde(&p);       c->title_f[lvl] = class_read_tilde(&p);     } else       class_fail("unknown keyword '%s'", key);     class_line_done(p);   }   fclose(fl);   cur_line = 0;   /* the checks below are about the whole file */   if (!done)     class_fail("file ended without an End line");   if (seen != SEEN_ALL)     class_fail("is missing a required line (Number, Name, Abbrev, Letter, Menu, Practice, PracPerLvl, Stats, HpGain, ManaGain, MoveGain all needed)");   for (lvl = 0; lvl <= LVL_IMPL; lvl++) {     if (!lvl_seen[lvl])       class_fail("has no Level %d row (need every level 0..%d)", lvl, LVL_IMPL);     if (!ttl_seen[lvl])       class_fail("has no Title %d line (need every level 0..%d)", lvl, LVL_IMPL);   }   log("   Class %d: %s (%s), letter %c, %d spell/skill levels, %d start skills, %d start eq.",       cnum, c->name, c->abbrev, c->letter, c->num_skills, c->num_start_skills, c->num_start_eq); } /* ---------- the class list and the glue ---------- */ /* Bramage: build the "Select a class:" menu from each class's Menu line, * sorted by its menu position (lowest first, ties keep class.lst order). * With the stock files this is exactly the stock menu text. */ static void build_class_menu(void) {   static char menu[MAX_STRING_LENGTH];   int order[NUM_CLASSES], i, j, tmp;   size_t len;   for (i = 0; i < NUM_CLASSES; i++)     order[i] = i;   for (i = 1; i < NUM_CLASSES; i++)      /* insertion sort, keeps ties */     for (j = i; j > 0 && class_table[order[j]].menu_pos < class_table[order[j - 1]].menu_pos; j--) {       tmp = order[j]; order[j] = order[j - 1]; order[j - 1] = tmp;     }   len = snprintf(menu, sizeof(menu), "\r\nSelect a class:\r\n");   for (i = 0; i < NUM_CLASSES && len < sizeof(menu); i++)     len += snprintf(menu + len, sizeof(menu) - len, "  %s\r\n", class_table[order[i]].menu_text);   class_menu = menu; } void load_class_files(void) {   char path[PATH_MAX], line[MAX_STRING_LENGTH], fname[MAX_INPUT_LENGTH];   char *p;   int count = 0, ended = FALSE, i, j;   FILE *fl;   /* Start guild_info with just the end marker; Guild lines add to it. */   guild_info[0].pc_class = -1;   guild_info[0].guild_room = NOWHERE;   guild_info[0].direction = -1;   snprintf(path, sizeof(path), "%s", CLASS_LIST_FILE);   cur_file = path;   cur_line = 0;   if (!(fl = fopen(path, "r")))     class_fail("can't open the class list (copy lib/class/ into your lib directory)");   while (!ended && class_get_line(fl, line, sizeof(line))) {     p = line;     skip_spaces(&p);     if (!*p || *p == '*')       continue;     if (*p == '$') {       ended = TRUE;       break;     }     class_read_word(&p, fname, sizeof(fname), "class file name");     if (count >= NUM_CLASSES)       class_fail("lists more than NUM_CLASSES (%d) classes.  Bump NUM_CLASSES and add a CLASS_ #define in structs.h first", NUM_CLASSES);     {       int list_line = cur_line;       load_one_class(fname, count);   /* changes cur_file/cur_line while it works */       cur_file = path;       cur_line = list_line;     }     count++;   }   fclose(fl);   cur_line = 0;   if (!ended)     class_fail("the class list must end with a line holding just '$'");   if (count != NUM_CLASSES)     class_fail("lists %d classes but NUM_CLASSES in structs.h is %d.  They must match", count, NUM_CLASSES);   /* Bramage: catch two classes using the same name or menu letter. */   for (i = 0; i < NUM_CLASSES; i++)     for (j = i + 1; j < NUM_CLASSES; j++) {       if (!str_cmp(class_table[i].name, class_table[j].name))         class_fail("classes %d and %d are both named '%s'", i, j, class_table[i].name);       if (class_table[i].letter == class_table[j].letter)         class_fail("classes %d and %d both use menu Letter '%c'", i, j, class_table[i].letter);     }   /* Copy into the old-style tables the rest of the code reads. */   for (i = 0; i < NUM_CLASSES; i++) {     class_abbrevs[i] = class_table[i].abbrev;     pc_class_types[i] = class_table[i].name;     prac_params[0][i] = class_table[i].prac_learned;     prac_params[1][i] = class_table[i].prac_max_gain;     prac_params[2][i] = class_table[i].prac_min_gain;     prac_params[3][i] = class_table[i].prac_type;   }   class_abbrevs[NUM_CLASSES] = "\n";   pc_class_types[NUM_CLASSES] = "\n";   /* Add the all-class guards after the per-class ones. */   for (i = 0; guild_info[i].guild_room != NOWHERE; i++)     ;   for (j = 0; all_class_guards[j].guild_room != NOWHERE && i < MAX_GUILD_ENTRIES; j++, i++)     guild_info[i] = all_class_guards[j];   guild_info[i].pc_class = -1;   guild_info[i].guild_room = NOWHERE;   guild_info[i].direction = -1;   build_class_menu();   log("   Loaded %d classes from %s.", count, CLASS_LIST_FILE); }

Finally attached are the CLS files that go into a directory called /lib/class

I make no disclaimer that this will work perfectly or not break your mud. Please make sure of all the code before adding and adjust as needed for your MUD.

File Attachment:

File Name: class.zip
File Size:17.01 KB

Just a guy coding a mud at home for no reason but the challenge.
The following user(s) said Thank You: thomas

Please Log in or Create an account to join the conversation.

Time to create page: 0.320 seconds