#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "player.h"
/*
* Remmber to add new class's to the bottem of the table. bad happens
*/
const struct class_type class_table [] =
{
/* Class Name Trust Lvl Gen Bits */
{0, "Mortal", "", 2, 2, 0, BIT_CLOSED },
{CLASS_DEMON, "Demon", "{r", 4, 3, 4, 0 },
{CLASS_MAGE, "Warlock", "{C", 5, 4, 3, 0 },
{CLASS_WEREWOLF, "Werewolf", "{G", 3, 3, 7, 0 },
{CLASS_VAMPIRE, "Vampire", "{R", 3, 3, 4, 0 },
{CLASS_DROW, "Drow", "{M", 4, 3, 5, 0 },
{CLASS_NINJA, "Ninja", "{m", 5, 3, 10,0 },
{CLASS_MONK, "Monk", "{c", 6, 5, 4, 0 },
{CLASS_DRAGON, "Dragon", "{x", 3, 3, 5, BIT_CLOSED|BIT_DONTCLASS },
{CLASS_ANGEL, "Angel", "{W", 3, 3, 4, 0 },
{CLASS_PRIEST, "Priest", "{B", 3, 3, 4, 0 },
{CLASS_BARD, "Bard", "", 3, 3, 4, BIT_CLOSED|BIT_DONTCLASS },
{0, "", 0, 0, 0, 0 }
};
char * class_name( int class )
{
int a;
for (a = 0;class_table[a].class_name[0] != '\0';a++)
if (class_table[a].class == class)
break;
if (class_table[a].class_name[0] != '\0')
return class_table[a].class_name;
return "(Error)";
}
int class_lookup(int class)
{
int a;
for (a = 0;class_table[a].class_name[0] != '\0';a++)
if (class_table[a].class == class)
break;
if (class_table[a].class_name[0] != '\0')
return a;
return -1;
}
int class_lookupn(char * class)
{
int a;
for (a = 0;class_table[a].class_name[0] != '\0';a++)
if (!str_cmp(class_table[a].class_name, class))
break;
if (class_table[a].class_name[0] != '\0')
return a;
return -1;
}
bool IS_CLOSED( int cl )
{
if( IS_SET(class_table[cl].bits, BIT_CLOSED) )
return TRUE;
if( IS_SET(class_table[cl].bits, BIT_DONTCLASS ) )
return TRUE;
return FALSE;
}
void do_selfclass(CHAR_DATA *ch, char *argument)
{
char arg1[MIL];
int cl;
if (IS_NPC(ch))
return;
argument = one_argument(argument, arg1);
if (arg1[0] == '\0')
{
send_to_char("You may choose from:\n\r",ch);
ch_printf( ch, "{r*{n--------------{r*{n-----{r*{x\n\r" );
for (cl = 0;class_table[cl].class_name[0] != '\0'; cl++)
{
ch_printf(ch, "{r* {R%-12.12s {r* {n%-3.3s {r*{x\n\r",
class_table[cl].class_name,
IS_CLOSED(cl) ? "No" : "Yes" );
}
send_to_char("\n\r{x",ch);
return;
}
if (ch->max_hit < 1000
|| ch->max_mana < 1000
|| ch->max_move < 1000)
{
send_to_char("You need 1,000 hp, 1,000 mana, 1,000 move to be classed.\r\n", ch);
return;
}
if (ch->class != 0
|| IS_SET( PC(ch,stats[UNI_AFF]), VAM_MORTAL) )
{
send_to_char("You are already classed!\r\n", ch);
return;
}
if ( (cl = class_lookupn(arg1)) == -1)
{
stc("That class doesn't exist!\n\r",ch);
return;
}
if ( IC_BIT_NAME(arg1, BIT_CLOSED) && ch->trust < 7 )
{
stc("That class is closed.\n\r", ch);
return;
}
if (IC_BIT_NAME(arg1, BIT_DONTCLASS)
&& ch->level < LEVEL_BUILDER)
{
stc("That class is closed to the mortals.\n\r",ch);
return;
}
ch->class = class_table[cl].class;
ch->trust = class_table[cl].start_trust;
ch->level = class_table[cl].start_level;
PC(ch,stats[UNI_GEN]) = class_table[cl].start_gen;
if( IS_CLASS(ch,CLASS_MAGE) )
{
ch->pcdata->powers[MPOWER_RUNE0] = number_range(0,4);
ch->pcdata->powers[MPOWER_RUNE1] = 2047;
ch->pcdata->powers[MPOWER_RUNE2] = 1023;
ch->pcdata->powers[MPOWER_RUNE3] = 15;
} else if( IS_CLASS(ch, CLASS_DEMON) )
SET_BIT(ch->special, SPC_CHAMPION);
ch_printf(ch, "{CYou are now a %s!{x\n\r",class_table[cl].class_name);
update_class(ch);
return;
}