daleken/
daleken/data/notes/
daleken/data/player/
daleken/data/system/poses/
daleken/doc/Homepage/images/
daleken/log/
Classes are far more difficult to add in Daleken, firstly you must
understand the class system in all it's gruesome details and THAT is
tedious to explain.  So basically, don't bother unless you are gung-ho.


=== Classes

The central organizing table for classes is class_table, which is an array of
type 'struct class_type' (defined in 'merc.h') and is defined in 'const.c'.
Mobs have class 0, and players have classes 0 through MAX_CLASS-1.

The fields of class_table are:

    char *	who_name;

	This three-letter name is used for the 'who' listing.  It's also used
	for the list of classes shown to new characters for selecting a class,
	and for matching the player's input in selecting a class.

    char *	name;

	This is the actual name of the class, used in instances where title
	is far more important.

    int 	attr_prime;

	This attribute is initialized to 16 for new chars of this class.  It
	costs only three practices to train one's prime attribute, versus five
	practices for any other attribute.  In addition, characters may
	increase their prime attribute (only) over 18 by using magic items.

    int 	weapon;

	This object (vnum) is given to new characters of this class for their
	first weapon.

    int 	mudschool;

	This room (vnum) is off limits to characters of other classes.

    int 	skill_adept;

	This is the maximum level to which a character of this class may train
	a skill or spell.

    int		combat_no;

	This is the magic number used to add to the classes attacking.  The
	higher the better and an average of about 400 is normal with only
	slight adjustments.

    int 	hp_min;			/* Min hp gained on leveling	*/
    int 	hp_max;			/* Max hp gained on leveling	*/
    int		fMana;			/* Class gains mana on level	*/

	The fields hp_min and hp_max are the minimum and maximum hit points
	gained on advancing a level (in addition to the constitution bonus).
	fMana is a scale of 1 to 10 for how much mana the class gains,
	10 - 100%, 1 - 10%, 5 - 50% and so on.  fMana also determines other
	mana based characteristics like starting mana (50 + 5*fMana)

=== Daleken class structure

Daleken uses a system of basic class and advanced class.  A character will
choose their initial class out of the 5 (or AVAIL_CLASS) available classes
for 50 levels this will be their class after which they get the opurtunity
to multiclass and become two classes at once.  Here the character can opt
to multiclass in their initial class, becoming specialised in that class.

When becoming the second class, the character stays at the same level and
gains in 'sublevels' which give them only half gains upon each advancement
and when their sublevel passes their actual level they are then moved to
the next real level and they are said to have completed their multiclassing.

(eg at level 55 a warrior multiclasses to cleric, he then is a level 55 war
and a level 1 cle.  As he continues to gain levels only his cleric level, or
sublevel rises until it reaches 55, equal to his warrior level.  When he
levels again he becomes level 56 in both classes and he has completed his
multiclassing.)

After a player multiclasses they become an entirely new class based on the
two classes they know.  This follows from the table below:

+---------------+---------------------- FIRST CLASS -------------------------+
|SECOND CLASS   | MAGE        CLERIC   THIEF      WARRIOR    MARTIAL ARTIST  |
|---------------+------------------------------------------------------------+
|MAGE           |*Sorceror    Warlock  Illusionist Ranger    Psionicist      |
|               |							     |
|CLERIC         | Warlock    *Bishop   Bard        Paladin   Monk	     |
|               |							     |
|THIEF          | Illusionist Bard    *Assassin    Crusader  Ninja	     |
|               |							     |
|WARRIOR        | Ranger      Paladin  Crusader   *Knight    Samurai	     |
|               |							     |
|MARTIAL ARTIST | Psionicist  Monk     Ninja       Samurai  *Mystic	     |
+---------------+------------------------------------------------------------+
* - specialist class.

The experience required to level increases after this multiclassing although
specialising classes (Sorceror, Bishop, Assassin, Knight, Mystic) don't have
as big an increase.  The new character has entirely become the new class and
each of these new classes have new skills of their own which add to the
skills from the classes they inherit from.  As is obvious, a specialising
class doesn't gain extra skills from a second class, however the skills from
their first class become extremely familiar and they have the opurtunity to
practive these to 100% adept, extremely useful as success is based on this
percentage in many things.

This first multiclassing is made available to the character at level 50 but
it can be left to be done any time less than level 250, but multiclassing
cannot be done while on level 250.

Up to two additional multiclassings can be made, however the chance to
specialise only comes once and the experience required to level raises every
time.  These multiclassings can be added any time after level 100 and the
second after level 200.


=== Adding a base class (complex and tedious)

This classing system requires each of the base classes (5) and all
combinations of classes (15) to be individual classes, they are as follows:

{ mag, cle, thi, war, mar,    <-- base classes
  sor, wlk, ill, ran, psi,    <-- mage combinations
       bis, bar, pal, mnk,    <-- remaining cleric combinations
            ass, cru, nnj,    <-- remaining thief combinations
                 kni, sam,    <-- remaining warrior combinations
                      mys,    <-- the single remaining mar combination
            builder, angel },  

This follows from the upper right of the table, the first line being the base
classes available (mag, cle, thi, war, mar) the next 5 lines arranged in
a triangle are firstly all combinations of mag multiclasses, then all
remaining combinations of cle multiclasses and so on...

Note that the two classes builder and angel are put after the multiclasses,
any special classes can be put here, which allows flexibility in adding
classes for unique purposes like builders and angels in this instance.

To add a new base class you must also decide on what the combinations are to
be (you will need six(6) combination classes) and you then add the classes
into the pattern as below:

{ mag, cle, thi, war, mar, NEWCLASS   <-- base classes
  sor, wlk, ill, ran, psi, NEW-MAG    <-- mage combinations
       bis, bar, pal, mnk, NEW-CLE    <-- remaining cleric combinations
            ass, cru, nnj, NEW-THI    <-- remaining thief combinations
                 kni, sam, NEW-WAR    <-- remaining warrior combinations
                      mys, NEW-MAR    <-- remaining martial combinations
                           NEW-NEW    <-- specialist class
            builder, angel },

Once in this order you increase AVAIL_CLASS by one and MAX_CLASS by
AVAIL_CLASS, (ie AVAIL_CLASS++; MAX_CLASS += 6)
Add the defines for the new classes and follow the steps for each to
add each of the 6 (AVAIL_CLASS) new classes.

The second classes will probably have combat_no, hp_min, hp_max, fMana
equal to the average of the two base classes, but you can choose a medium,
keeping in mind that a mage used to getting mana might not like it if they
suddenly cease gaining mana after they multiclass as a warrior.

Careful note: when adding the max level lines to const.c, be careful to
actually put the proper levels in, a NEW-MAG multiclasser will have all the
skills from their two inherited classes and they must have the skill_level
set to the minimum level that their base classes get the skill as follows:

{    28, L_APP, L_APP, L_APP, L_APP,      /* mag->mar */
     28,    28,    28,    28,    28,      /* mag multi classes */
         L_APP, L_APP, L_APP, L_APP,      /* cle multi classes */
                L_APP, L_APP, L_APP,      /* thi */
                       L_APP, L_APP,      /* war */
                              L_APP,      /* mar */
                       L_APP, L_APP},     /* bld, ang*/

As you can see all the mage multiclasses get the skill at the same level.
Below you can see how multiple classes with the skill are done:

{    14,     5, L_APP, L_APP, L_APP,
     14,     5,    14,    14,    14,
             5,     5,     5,     5,
                L_APP, L_APP, L_APP,
                       L_APP, L_APP,
                              L_APP,
                       L_APP, L_APP },

Mages get this skill at level 14 and clerics at level 5, but you can see that
the mage-cleric (warlock) gains the skill at level 5, the lesser of the two.
Below is a more complex pattern, a skill that every class gets, but at
different levels:

{     3,     5,     7,    10,    6,
      3,     3,     3,     3,    3,
             5,     5,     5,    5,
                    7,     7,    6,
                          10,    6,
                                 6,
                      L_APP, L_APP },


=== Adding a new class (basic)

This section enumerates the changes that need to be made to the base level
Envy 2.2 code necessary for the addition of a new class.  These changes
presuppose that certain functions (spells, skills) and structures (skill
definitions, poses, titles, etc.) are already made.  These assumptions
are summarized at the end of the file.  For more detailed information
on adding skills and spells, see 'skill.txt'.

MERC.H		- Increase MAX_SKILL by as many skills/spells as you add
------		- Increase MAX_CLASS by one
		- Declare external variables for gsn numbers, as defined
		  in DB.C, in the following form:
		- #define CLASS_<class name> <class number> below others

extern  int  gsn_<skill/spell_name>

		- DECLARE_DO_FUN( do_<skill_name> ) for all skills
		- DECLARE_SPELL_FUN( spell_<spell_name> ) for all spells
		  --- note that do_<skill_name> and spell_<spell_name>
		      are the C function names of the skills/spells
		      as they exist in magic.c and/or other files

DB.C		- Declare variables for gsn numbers, which are grabbed
----		  by MERC.H for use in all other files:

int             gsn_<skill/spell_name>

		  --- note that gsn numbers are usually used for all
		      skills, and are occasionally used for spells.
                      They are used to speed things up, rather than
                      call skill_lookup each time a skill/spell is used.
		      Don't worry about assigning values to them, they
		      are assigned automatically on startup.

INTERP.C	- Add to cmd_table[ ] any skills (or anything else) that
--------	  will need to be recognized by their name as a command.
		  for example, 

    { "shadow form",    do_shadow,      POS_STANDING,    0,  LOG_NORMAL },

CONST.C		- Add class definition (structure) to class_table
-------		- Change ALL skill_level's in skill_table to have
		  MAX_CLASS values, i.e.

        "armor",                {     5,     1, L_APP, L_APP, L_APP, L_APP },

		  This spell now has 6 values, corresponding to 6
		  classes.  (This step is probably the most painful.)
		- Add all skill/spell definitions to skill_table.
		- If your class will have access to existing skills
		  and/or spells, change the value you added above (L_APP)
		  to the appropriate level for your class

MAGIC.C		- Add code (spell_<name> functions) for all new spells.
-------		  Best location would probably be at the end of the file,
		  though order is immaterial.

ACT_####.C	- Add code (do_<name> functions) for all skills.
----------

SPECIAL.C	- If your class will have mobs that use spec_funs
---------         (usually guildmasters, waiters, etc), do the
		  following:
		  - Add spec_fun declaration for spec_cast_<class name>
		  - Add spec_cast_<class name> to table.

HELP.ARE	- Add all HELPS for new spells, skills, class, or any
--------	  other helps that will aid players
		- Modify existing helps, if desired, to include similar
		  skills/spells (i.e., add Levitation to help for Fly,
		  rather than create a new HELP for Levitation alone)


NECESSARY FILES AND/OR FUNCTIONS:
---------------------------------
CONST.C		- class definition for class_table
CONST.C		- skill/spell definitions for skill_table
MAGIC.C		- spell code
ACT_####.C	- skill code
SPECIAL.C	- spec_fun code (if any)
HELP.ARE	- Helps for your new class

Clearly, adding a new class is time-consuming, but a little preparation
can go a long way in reducing your headaches!