~case/dbns

a07f0e945bb04b02cbe81ed8b3def6be1d792f0e — case 4 years ago 2e1929a
wip
8 files changed, 214 insertions(+), 2080 deletions(-)

M src/Makefile
D src/ban.c
M src/bet.h
M src/comm.c
D src/commands
D src/imm_host.c
M src/interp.c
M src/space.c
M src/Makefile => src/Makefile +4 -4
@@ 10,22 10,22 @@ DATA_FOLDERS = ../area ../clans ../classes ../councils ../deity ../doc ../gods \
C_FLAGS = -O2 -g3 -Wall -std=c99 ${DBUGFLG} ${TIME} ${REG}
L_FLAGS = ${MATH_LINK} -lz

O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o ban.o \
O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o \
          board.o boards.o bounty.o build.o clans.o colorize.o comm.o \
          comments.o const.o db.o deity.o editor.o fight.o finger.o grub.o \
          handler.o hashstr.o hiscores.o house.o ibuild.o \
          imm_host.o interp.o magic.o makeobjs.o mapout.o marry.o \
          interp.o magic.o makeobjs.o mapout.o marry.o \
          misc.o mpxset.o mud_comm.o mud_prog.o new_fun.o pfiles.o planes.o \
          planet.o player.o rare.o requests.o reset.o save.o \
          shops.o skills.o skills_android.o skills_dbs.o skills_genie.o \
          space.o special.o stat_obj.o tables.o update.o dns.o \
          sha256.o

C_FILES = act_comm.c act_info.c act_move.c act_obj.c act_wiz.c ban.c \
C_FILES = act_comm.c act_info.c act_move.c act_obj.c act_wiz.c \
          board.c boards.c bounty.c build.c clans.c colorize.c comm.c \
          comments.c const.c db.c deity.c editor.c fight.c finger.c grub.c \
          handler.c hashstr.c hiscores.c house.c ibuild.c \
          imm_host.c interp.c magic.c makeobjs.c mapout.c marry.c \
          interp.c magic.c makeobjs.c mapout.c marry.c \
          misc.c mpxset.c mud_comm.c mud_prog.c new_fun.c pfiles.c planes.c \
          planet.c player.c rare.c requests.c reset.c save.c \
          shops.c skills.c skills_android.c skills_dbs.c\

D src/ban.c => src/ban.c +0 -1350
@@ 1,1350 0,0 @@
/****************************************************************************
* [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame      |   \\._.//   *
* -----------------------------------------------------------|   (0...0)   *
* SMAUG 1.4 (C) 1994, 1995, 1996, 1998  by Derek Snider      |    ).:.(    *
* -----------------------------------------------------------|    {o o}    *
* SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus,      |   / ' ' \   *
* Scryn, Rennard, Swordbearer, Gorog, Grishnakh, Nivek,      |~'~.VxvxV.~'~*
* Tricops and Fireblade                                      |             *
* ------------------------------------------------------------------------ *
* Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael        *
* Chastain, Michael Quan, and Mitchell Tse.                                *
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,          *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.     *
* ------------------------------------------------------------------------ *
*                            Ban module by Shaddai                         *
****************************************************************************/



#include <string.h>
#include <stdbool.h>
#include <ctype.h>
#include <stdio.h>
#include <time.h>
#include "mud.h"


/* Local functions */
void fread_ban args ( ( FILE *fp, int type ) );
bool check_expire args ( ( BAN_DATA *ban ) );
void dispose_ban args ( ( BAN_DATA *ban, int type ) );
void free_ban args ( ( BAN_DATA *pban ) );

/* Global Variables */

BAN_DATA *first_ban;
BAN_DATA *last_ban;
BAN_DATA *first_ban_class;
BAN_DATA *last_ban_class;
BAN_DATA *first_ban_race;
BAN_DATA *last_ban_race;


/*
 * Load all those nasty bans up :)
 * 	Shaddai
 */
void
load_banlist ( void )
{
	char buf[MAX_STRING_LENGTH];
	char *word;
	FILE *fp;
	bool fMatch = false;

	if (!(fp = fopen (BAN_LIST, "r")))
	{
	bug ("Save_banlist: Cannot open " BAN_LIST, 0);
		perror (BAN_LIST);
		return ;
	}
	for ( ; ; )
	{
		word = feof (fp) ? "END" : fread_word ( fp );
		fMatch = false;
		switch ( UPPER ( word[0] ) )
		{
			case 'C':
				if ( !str_cmp ( word, "CLASS" ) )
				{
					fread_ban ( fp, BAN_CLASS );
					fMatch = true;
				}
				break;
			case 'E':
				if ( !str_cmp ( word, "END")) /*File should always contain END*/
				{
					fclose ( fp );
					log_string ( "Done." );
					return ;
				}
			case 'R':
				if ( !str_cmp ( word, "RACE" ) )
				{
					fread_ban ( fp, BAN_RACE );
					fMatch = true;
				}
				break;
			case 'S':
				if ( !str_cmp ( word, "SITE" ) )
				{
					fread_ban ( fp, BAN_SITE );
					fMatch = true;
				}
				break;
		}
		if ( !fMatch )
		{
			sprintf ( buf, "Load_banlist: no match: %s", word );
			bug ( buf, 0 );
		} /* End of switch statement */
	} /* End of for loop */
}

/*
 * Load up one class or one race ban structure.
 */

void
fread_ban ( FILE *fp, int type )
{
	BAN_DATA *pban;
	int i = 0;
	bool fMatch = false;

	CREATE ( pban, BAN_DATA, 1 );

	pban->name = fread_string_nohash ( fp );
	pban->user = NULL;
	pban->level = fread_number( fp );
	pban->duration = fread_number( fp );
	pban->unban_date = fread_number( fp );
	if ( type == BAN_SITE )
	{ /* Sites have 2 extra numbers written out */
		pban->prefix = fread_number( fp );
		pban->suffix = fread_number( fp );
	}
	pban->warn = fread_number( fp );
	pban->ban_by = fread_string_nohash( fp );
	pban->ban_time = fread_string_nohash( fp );
	pban->note = fread_string( fp );

	/* Need to lookup the class or race number if it is of that type */

	if ( type == BAN_CLASS )
		for ( i = 0; i < MAX_CLASS; i++ )
		{
			if ( !str_cmp( class_table[i]->who_name, pban->name ) )
			{
				fMatch = true;
				break;
			}
		}
	else if ( type == BAN_RACE )
		for ( i = 0; i < MAX_RACE; i++ )
		{
			if ( !str_cmp( race_table[i]->race_name, pban->name ) )
			{
				fMatch = true;
				break;
			}
		}
	else if ( type == BAN_SITE )
		for ( i = 0; i < strlen( pban->name); i ++ )
		{
			if ( pban->name[i] == '@' )
			{
				char *temp;
				char *temp2;

				temp = str_dup( pban->name );
				temp[i] = '\0';
				temp2 = &pban->name[i + 1];
				DISPOSE( pban->name );
				pban->name = str_dup( temp2 );
				pban->user = str_dup( temp );
				DISPOSE( temp );
				break;
			}
		}

	if ( type == BAN_RACE || type == BAN_CLASS )
	{
		if ( fMatch )
			pban->flag = i;
		else /* The file is corupted throw out this ban structure */
		{
			bug("Bad class structure %d.\n\r", i );
			free_ban( pban );
			return ;
		}
	}
	if ( type == BAN_CLASS )
		LINK( pban, first_ban_class, last_ban_class, next, prev );
	else if ( type == BAN_RACE )
		LINK( pban, first_ban_race, last_ban_race, next, prev );
	else if ( type == BAN_SITE )
		LINK( pban, first_ban, last_ban, next, prev );
	else /* Bad type throw out the ban structure */
	{
		bug("Fread_ban: Bad type %d", type );
		free_ban( pban );
	}
	return ;
}

/*
 * Saves all bans, for sites, classes and races.
 * 	Shaddai
 */

void
save_banlist ( void )
{
	BAN_DATA *pban;
	FILE *fp;

	if (!(fp = fopen (BAN_LIST, "w")))
	{
		bug ("Save_banlist: Cannot open " BAN_LIST, 0);
		perror (BAN_LIST);
		return ;
	}

	/* Print out all the site bans */

	for (pban = first_ban; pban; pban = pban->next)
	{
		fprintf (fp, "SITE\n" );
		if ( pban->user )
			fprintf ( fp, "%s@%s~\n", pban->user, pban->name );
		else
			fprintf (fp, "%s~\n", pban->name );
		fprintf (fp, "%d %d %d %d %d %d\n", pban->level, pban->duration,
		         pban->unban_date, pban->prefix, pban->suffix, pban->warn );
		fprintf (fp, "%s~\n%s~\n%s~\n", pban->ban_by, pban->ban_time,
		         pban->note );
	}

	/* Print out all the race bans */

	for (pban = first_ban_race; pban; pban = pban->next )
	{
		fprintf (fp, "RACE\n" );
		fprintf (fp, "%s~\n", pban->name );
		fprintf (fp, "%d %d %d %d\n", pban->level, pban->duration,
		         pban->unban_date, pban->warn );
		fprintf (fp, "%s~\n%s~\n%s~\n", pban->ban_by, pban->ban_time,
		         pban->note );
	}

	/* Print out all the class bans */

	for (pban = first_ban_class; pban; pban = pban->next )
	{
		fprintf (fp, "CLASS\n" );
		fprintf (fp, "%s~\n", pban->name );
		fprintf (fp, "%d %d %d %d\n", pban->level, pban->duration,
		         pban->unban_date, pban->warn );
		fprintf (fp, "%s~\n%s~\n%s~\n", pban->ban_by, pban->ban_time,
		         pban->note );
	}
	fprintf (fp, "END\n"); /* File must have an END even if empty */
	fclose (fp);
	return ;
}

/*
 * The main command for ban, lots of arguments so be carefull what you
 * change here.		Shaddai
 */

void
do_ban ( CHAR_DATA *ch, char *argument )
{
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char arg3[MAX_INPUT_LENGTH];
	char arg4[MAX_INPUT_LENGTH];
	char *temp;
	BAN_DATA *pban;
	int value = 0, time;

	if (IS_NPC (ch)) /* Don't want mobs banning sites ;) */
	{
		send_to_char ("Monsters are too dumb to do that!\n\r", ch);
		return ;
	}

	if (!ch->desc) /* No desc means no go :) */
	{
		bug ("do_ban: no descriptor", 0);
		return ;
	}

	set_char_color( AT_IMMORT, ch );
	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );
	argument = one_argument( argument, arg3 );
	argument = one_argument( argument, arg4 );

	/* Do we have a time duration for the ban? */

	if ( arg4[0] != '\0' && is_number( arg4 ) )
		time = atoi( arg4 );
	else
		time = -1;


	/* -1 is default, but no reason the time should be greater than 1000
	 * or less than 1, after all if it is greater than 1000 you are talking
	 * around 3 years.
	 */

	if ( time != -1 && ( time < 1 || time > 1000 ) )
	{
		send_to_char("Time value is -1 (forever) or from 1 to 1000.\n\r", ch);
		return ;
	}

	/*
	 * Need to be carefull with sub-states or everything will get messed up.
	 */

	switch ( ch->substate )
	{
		default:
			bug ("do_ban: illegal substate", 0);
			return ;
		case SUB_RESTRICTED:
			send_to_char ("You cannot use this command from within another command.\n\r", ch);
			return ;
		case SUB_NONE:
			ch->tempnum = SUB_NONE;
			break;

			/* Returning to end the editing of the note */

		case SUB_BAN_DESC:
			add_ban( ch, "", "", 0, 0 );
			return ;
	}
	if ( arg1[0] == '\0' )
		goto syntax_message;

	/* If no args are sent after the class/site/race, show the current banned
	 * items.  Shaddai
	 */

	if ( !str_cmp ( arg1, "site" ) )
	{
		if ( arg2[0] == '\0' )
		{
			show_bans( ch, BAN_SITE );
			return ;
		}

		/* Are they high enough to ban sites? */

		if ( get_trust(ch) < sysdata.ban_site_level )
		{
			ch_printf(ch, "You must be %d level to add bans.\n\r", sysdata.ban_site_level);
			return ;
		}
		if ( arg3[0] == '\0' )
			goto syntax_message;
		if ( !add_ban ( ch, arg2, arg3, time, BAN_SITE ) )
			return ;
	}
	else if ( !str_cmp ( arg1, "race" ) )
	{
		if ( arg2[0] == '\0' )
		{
			show_bans( ch, BAN_RACE );
			return ;
		}

		/* Are they high enough level to ban races? */

		if ( get_trust(ch) < sysdata.ban_race_level )
		{
			ch_printf(ch, "You must be %d level to add bans.\n\r", sysdata.ban_race_level);
			return ;
		}
		if ( arg3[0] == '\0' )
			goto syntax_message;
		if ( !add_ban(ch, arg2, arg3, time, BAN_RACE ) )
			return ;
	}
	else if ( !str_cmp ( arg1, "class" ) )
	{
		if ( arg2[0] == '\0' )
		{
			show_bans( ch, BAN_CLASS );
			return ;
		}

		/* Are they high enough to ban classes? */

		if ( get_trust(ch) < sysdata.ban_class_level )
		{
			ch_printf(ch, "You must be %d level to add bans.\n\r", sysdata.ban_class_level);
			return ;
		}
		if ( arg3[0] == '\0' )
			goto syntax_message;
		if ( !add_ban(ch, arg2, arg3, time, BAN_CLASS ) )
			return ;
	}
	else if ( !str_cmp ( arg1, "show" ) )
	{

		/* This will show the note attached to a ban */

		if ( arg2[0] == '\0' || arg3[0] == '\0' )
			goto syntax_message;
		temp = arg3;
		if ( arg3[0] == '#' ) /* Use #1 to show the first ban*/
		{
			temp = arg3;
			temp++;
			if ( !is_number( temp ) )
			{
				send_to_char("Which ban # to show?\n\r", ch);
				return ;
			}
			value = atoi(temp);
			if ( value < 1 )
			{
				send_to_char ("You must specify a number greater than 0.\n\r", ch);
				return ;
			}
		}
		if ( !str_cmp ( arg2, "site" ) )
		{
			pban = first_ban;
			if ( temp[0] == '*' )
				temp++;
			if ( temp[strlen(temp) - 1] == '*' )
				temp[strlen(temp) - 1] = '\0';
		}
		else if ( !str_cmp ( arg2, "class" ) )
			pban = first_ban_class;
		else if ( !str_cmp ( arg2, "race" ) )
			pban = first_ban_race;
		else
			goto syntax_message;
		for ( ; pban; pban = pban->next )
			if ( value == 1 || !str_cmp ( pban->name, temp ) )
				break;
			else if ( value > 1 )
				value--;

		if ( !pban )
		{
			send_to_char ("No such ban.\n\r", ch);
			return ;
		}
		ch_printf(ch, "Banned by: %s\n\r", pban->ban_by );
		send_to_char ( pban->note, ch );
		return ;
	}
	else
		goto syntax_message;
	return ;

	/* Catch all syntax message, make sure that return stays above this or you
	 * will get the syntax message everytime you issue the command even if it
	 * is a valid one.  Shaddai
	 */

syntax_message:
	send_to_char("Syntax: ban site  <address> <type> <duration>\n\r", ch );
	send_to_char("Syntax: ban race  <race>    <type> <duration>\n\r", ch );
	send_to_char("Syntax: ban class <class>   <type> <duration>\n\r", ch );
	send_to_char("Syntax: ban show  <field>   <number>\n\r", ch );
	send_to_char("Ban site lists current bans.\n\r", ch );
	send_to_char("Duration is the length of the ban in days.\n\r", ch );
	send_to_char("Type can be:  newbie, mortal, all, warn or level.\n\r", ch );
	send_to_char("In ban show, the <field> is site, race or class,", ch);
	send_to_char("  and the <number> is the ban number.\n\r", ch );
	return ;
}


/*
 * Allow a already banned site/class or race.  Shaddai
 */

void
do_allow ( CHAR_DATA *ch, char * argument )
{
	BAN_DATA *pban;
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char *temp = NULL;
	bool fMatch = false;
	int	value = 0;

	if (IS_NPC (ch)) /* No mobs allowing sites */
	{
		send_to_char ("Monsters are too dumb to do that!\n\r", ch);
		return ;
	}

	if (!ch->desc) /* No desc is a bad thing */
	{
		bug ("do_allow: no descriptor", 0);
		return ;
	}

	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );

	set_char_color (AT_IMMORT, ch);

	if ( arg1[0] == '\0' || arg2[0] == '\0')
		goto syntax_message;
	if ( arg2[0] == '#' ) /* Use #1 to ban the first ban in the list specified */
	{
		temp = arg2;
		temp++;
		if ( !is_number( temp ) )
		{
			send_to_char("Which ban # to allow?\n\r", ch);
			return ;
		}
		value = atoi(temp);
	}
	if ( !str_cmp( arg1, "site" ) )
	{
		if ( !value )
		{
			if ( strlen(arg2) < 2 )
			{
				send_to_char("You have to have at least 2 chars for a ban\n\r", ch);
				send_to_char("If you are trying to allow by number use #\n\r", ch);
				return ;
			}

			temp = arg2;
			if ( arg2[0] == '*' )
				temp++;
			if ( temp[strlen(temp) - 1] == '*' )
				temp[ strlen(temp) - 1] = '\0';
		}

		for ( pban = first_ban; pban; pban = pban->next )
		{
			/* Need to make sure we dispose properly of the ban_data
			               * Or memory problems will be created.
			 * Shaddai
			 */

			if ( value == 1 || !str_cmp ( pban->name, temp ) )
			{
				fMatch = true;
				dispose_ban( pban, BAN_SITE );
				break;
			}
			if ( value > 1 )
				value--;
		}
	}
	else if ( !str_cmp( arg1, "race" ) )
	{

		arg2[0] = toupper( arg2[0] );
		for ( pban = first_ban_race; pban; pban = pban->next )
		{
			/* Need to make sure we dispose properly of the ban_data
			               * Or memory problems will be created.
			 * Shaddai
			 */

			if ( value == 1 || !str_cmp ( pban->name, arg2 ) )
			{
				fMatch = true;
				dispose_ban( pban, BAN_RACE );
				break;
			}
			if ( value > 1 )
				value--;
		}
	}
	else if ( !str_cmp( arg1, "class" ) )
	{

		arg2[0] = toupper( arg2[0] );
		for ( pban = first_ban_class; pban; pban = pban->next )
		{
			/* Need to make sure we dispose properly of the ban_data
			               * Or memory problems will be created.
			 * Shaddai
			 */

			if ( value == 1 || !str_cmp ( pban->name, arg2 ) )
			{
				fMatch = true;
				dispose_ban( pban, BAN_CLASS );
				break;
			}
			if ( value > 1 )
				value--;
		}
	}
	else
		goto syntax_message;

	if ( fMatch )
	{
		save_banlist();
		ch_printf(ch, "%s is now allowed.\n\r", arg2 );
	}
	else
		ch_printf(ch, "%s was not banned.\n\r", arg2 );
	return ;

	/*
	 *  Make sure that return above stays in!
	 */

syntax_message:
	send_to_char ("Syntax: allow site  <address>\n\r", ch );
	send_to_char ("Syntax: allow race  <race>\n\r", ch );
	send_to_char ("Syntax: allow class <class>\n\r", ch );
	return ;
}

/*
 *  Sets the warn flag on bans.
 */
void
do_warn ( CHAR_DATA *ch, char *argument )
{
	char arg1[MAX_STRING_LENGTH];
	char arg2[MAX_STRING_LENGTH];
	char *name;
	int count = -1, type;
	BAN_DATA *pban, *start, *end;

	/*
	 * Don't want mobs or link-deads doing this.
	 */

	if (IS_NPC (ch))
	{
		send_to_char ("Monsters are too dumb to do that!\n\r", ch);
		return ;
	}

	if (!ch->desc)
	{
		bug ("do_warn: no descriptor", 0);
		return ;
	}

	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );

	if ( arg1[0] == '\0' || arg2[0] == '\0' )
		goto syntax_message;

	if ( arg2[0] == '#' )
	{
		name = arg2;
		name++;
		if ( !is_number( name ) )
			goto syntax_message;
		count = atoi( name );
		if ( count < 1 )
		{
			send_to_char("The number has to be above 0.\n\r", ch );
			return ;
		}
	}

	/*
	 *  We simply set up which ban list we will be looking at here.
	 */
	if ( !str_cmp( arg1, "class") )
		type = BAN_CLASS;
	else if ( !str_cmp( arg1, "race" ) )
		type = BAN_RACE;
	else if ( !str_cmp( arg1, "site" ) )
		type = BAN_SITE;
	else
		type = -1;


	if ( type == BAN_CLASS )
	{
		pban = first_ban_class;
		start = first_ban_class;
		end = last_ban_class;
		arg2[0] = toupper( arg2[0] );
	}
	else if ( type == BAN_RACE )
	{
		pban = first_ban_race;
		start = first_ban_race;
		end = last_ban_race;
		arg2[0] = toupper( arg2[0] );
	}
	else if ( type == BAN_SITE )
	{
		pban = first_ban;
		start = first_ban;
		end = last_ban;
	}
	else
		goto syntax_message;
	for ( ; pban && count != 0; count--, pban = pban->next )
		if ( count == -1 && !str_cmp(pban->name, arg2 ) )
			break;
	if ( pban )
	{
		/* If it is just a warn delete it, otherwise remove the warn flag. */

		if ( pban->warn )
		{
			if ( pban->level == BAN_WARN )
			{
				dispose_ban( pban, type );
				send_to_char("Warn has been deleted.\n\r", ch );
			}
			else
			{
				pban->warn = false;
				send_to_char("Warn turned off.\n\r", ch);
			}
		}
		else
		{
			pban->warn = true;
			send_to_char("Warn turned on.\n\r", ch );
		}
		save_banlist( );
	}
	else
	{
		ch_printf(ch, "%s was not found in the ban list.\n\r", arg2 );
		return ;
	}
	return ;
	/* The above return has to stay in! */
syntax_message:
	send_to_char ("Syntax: warn class <field>\n\r", ch );
	send_to_char ("Syntax: warn race  <field>\n\r", ch );
	send_to_char ("Syntax: warn site  <field>\n\r", ch );
	send_to_char ("Field is either #(ban_number) or the site/class/race.\n\r", ch);
	send_to_char ("Example:  warn class #1\n\r", ch );
	return ;
}

/*
 *  This actually puts the new ban into the proper linked list and
 *  initializes its data.  Shaddai
 */

int
add_ban( CHAR_DATA *ch, char *arg1, char *arg2, int time, int type )
{
	char arg[MAX_STRING_LENGTH];
	char buf[MAX_STRING_LENGTH];
	BAN_DATA *pban, *temp;
	struct tm *tms;
	char *name;
	int level, i, value;

	/* Should we check to see if they have dropped link sometime in between
	 * writing the note and now?  Not sure but for right now we won't since
	 * do_ban checks for that.  Shaddai
	 */

	switch ( ch->substate )
	{
		default:
			bug ("add_ban: illegal substate", 0);
			return 0;
		case SUB_RESTRICTED:
			send_to_char ("You cannot use this command from within another command.\n\r", ch);
			return 0;
		case SUB_NONE:
			{
				one_argument( arg1, arg );
				smash_tilde ( arg ); /* Make sure the immortals don't put a ~ in it. */

				if ( arg[0] == '\0' || arg2[0] == '\0')
					return 0;

				if ( is_number( arg2 ) )
				{
					level = atoi ( arg2 );
					if ( level < 0 || level > LEVEL_SUPREME )
					{
						ch_printf(ch, "Level range is from 0 to %d.\n\r", LEVEL_SUPREME );
						return 0;
					}
				}
				else if ( !str_cmp( arg2, "all" ) )
					level = LEVEL_SUPREME;
				else if ( !str_cmp( arg2, "newbie" ) )
					level = 1;
				else if ( !str_cmp( arg2, "mortal" ) )
					level = LEVEL_AVATAR;
				else if ( !str_cmp( arg2, "warn" ) )
					level = BAN_WARN;
				else
				{
					bug("Bad string for flag in add_ban.", 0 );
					return 0;
				}

				switch ( type )
				{
					case BAN_CLASS:
						if ( arg[0] == '\0' )
							return 0;
						if ( is_number( arg ) )
							value = atoi( arg );
						else
						{
							for ( i = 0; i < MAX_CLASS; i++ )
								if ( !str_cmp( class_table[i]->who_name, arg ) )
									break;
							value = i;
						}
						if (value < 0 || value >= MAX_CLASS)
						{
							send_to_char("Unknown class.\n\r", ch );
							return 0;
						}
						for ( temp = first_ban_class; temp; temp = temp->next )
						{
							if ( temp->flag == value )
							{
								if ( temp->level == level )
								{
									send_to_char ("That entry already exists.\n\r", ch);
									return 0;
								}
								else
								{
									temp->level = level;
									if ( temp->level == BAN_WARN )
										temp->warn = true;
									sprintf (buf, "%24.24s", ctime (&current_time));
									temp->ban_time = str_dup (buf);
									if ( temp->ban_by )
										DISPOSE( temp->ban_by );
									temp->ban_by = str_dup ( ch->name );
									send_to_char("Updated entry.\n\r", ch);
									return 1;
								}
							}
						}
						CREATE( pban, BAN_DATA, 1 );
						pban->name = str_dup ( class_table[value]->who_name );
						pban->flag = value;
						pban->level = level;
						pban->ban_by = str_dup ( ch->name );
						LINK( pban, first_ban_class, last_ban_class, next, prev );
						break;
					case BAN_RACE:
						if ( is_number( arg ) )
							value = atoi( arg );
						else
						{
							for ( i = 0; i < MAX_RACE; i++ )
								if ( !str_cmp(race_table[i]->race_name, arg) )
									break;
							value = i;
						}
						if (value < 0 || value >= MAX_RACE)
						{
							send_to_char("Unknown race.\n\r", ch );
							return 0;
						}
						for ( temp = first_ban_race; temp; temp = temp->next )
						{
							if ( temp->flag == value )
							{
								if ( temp->level == level )
								{
									send_to_char ("That entry already exists.\n\r", ch);
									return 0;
								}
								else
								{
									temp->level = level;
									if ( temp->level == BAN_WARN )
										temp->warn = true;
									sprintf (buf, "%24.24s", ctime (&current_time));
									temp->ban_time = str_dup (buf);
									if ( temp->ban_by )
										DISPOSE( temp->ban_by );
									temp->ban_by = str_dup ( ch->name );
									send_to_char("Updated entry.\n\r", ch);
									return 1;
								}
							}
						}
						CREATE( pban, BAN_DATA, 1 );
						pban->name = str_dup ( race_table[value]->race_name );
						pban->flag = value;
						pban->level = level;
						pban->ban_by = str_dup ( ch->name );
						LINK( pban, first_ban_race, last_ban_race, next, prev );
						break;
					case BAN_SITE:
						{
							bool prefix = false, suffix = false, user_name = false;
							char *temp_host = NULL, *temp_user = NULL;
							int x;

							for ( x = 0; x < strlen(arg); x++ )
							{
								if ( arg[x] == '@' )
								{
									user_name = true;
									temp_host = str_dup( &arg[x + 1]);
									arg[x] = '\0';
									temp_user = str_dup( arg );
									break;
								}
							}
							if ( !user_name )
								name = arg;
							else
								name = temp_host;
							if ( name[0] == '*' )
							{
								prefix = true;
								name++;
							}

							if ( name[strlen(name) - 1] == '*' )
							{
								suffix = true;
								name[strlen(name) - 1] = '\0';
							}
							for ( temp = first_ban; temp; temp = temp->next )
							{
								if ( !str_cmp ( temp->name, name ) )
								{
									if ( temp->level == level && (prefix && temp->prefix)
									     && ( suffix && temp->suffix ) && (!user_name ||
									                                       (user_name && !str_cmp(temp->user, temp_user))))
									{
										send_to_char ("That entry already exists.\n\r", ch);
										return 0;
									}
									else
									{
										temp->suffix = suffix;
										temp->prefix = prefix;
										if ( temp->level == BAN_WARN )
											temp->warn = true;
										temp->level = level;
										sprintf (buf, "%24.24s", ctime (&current_time));
										temp->ban_time = str_dup (buf);
										if ( temp->ban_by )
											DISPOSE( temp->ban_by );
										if ( user_name )
										{
											DISPOSE( temp_host );
											DISPOSE( temp_user );
										}
										temp->ban_by = str_dup ( ch->name );
										send_to_char("Updated entry.\n\r", ch);
										return 1;
									}
								}
							}
							CREATE( pban, BAN_DATA, 1 );
							pban->ban_by = str_dup ( ch->name );
							pban->suffix = suffix;
							pban->prefix = prefix;
							pban->name = str_dup( name );
							pban->level = level;
							if ( user_name )
							{
								pban->user = str_dup( temp_user );
								DISPOSE( temp_host );
								DISPOSE( temp_user );
							}
							LINK( pban, first_ban, last_ban, next, prev );
							break;
						}
					default:
						bug("Bad type in add_ban: %d.", type );
						return 0;
				}
				sprintf (buf, "%24.24s", ctime (&current_time));
				pban->ban_time = str_dup (buf);
				if ( time > 0 )
				{
					pban->duration = time;
					tms = localtime(&current_time);
					tms->tm_mday += time;
					pban->unban_date = mktime(tms);
				}
				else
				{
					pban->duration = -1;
					pban->unban_date = -1;
				}
				if ( pban->level == BAN_WARN )
					pban->warn = true;
				ch->substate = SUB_BAN_DESC;
				ch->dest_buf = pban;
				if ( !pban->note )
					pban->note = STRALLOC ("");
				;
				start_editing( ch, pban->note );
				return 1;
			}
		case SUB_BAN_DESC:
			pban = ch->dest_buf;
			if ( !pban )
			{
				bug ("do_ban: sub_ban_desc: NULL ch->dest_buf", 0);
				ch->substate = SUB_NONE;
				return 0;
			}
			if ( pban->note )
				STRFREE( pban->note );
			pban->note = copy_buffer( ch );
			stop_editing( ch );
			ch->substate = ch->tempnum;
			save_banlist( );
			if ( pban->duration > 0 )
			{
				if ( !pban->user )
					ch_printf (ch, "%s banned for %d days.\n\r", pban->name, pban->duration );
				else
					ch_printf (ch, "%s@%s banned for %d days.\n\r", pban->user, pban->name, pban->duration );
			}
			else
			{
				if ( !pban->user )
					ch_printf (ch, "%s banned forever.\n\r", pban->name );
				else
					ch_printf (ch, "%s@%s banned forever.\n\r", pban->user, pban->name );
			}
			return 1;
	}
	return 1;
}

/*
 * Print the bans out to the screen.  Shaddai
 */

void
show_bans ( CHAR_DATA *ch, int type )
{
	BAN_DATA *pban;
	int bnum;

	set_pager_color (AT_IMMORT, ch);

	switch ( type )
	{
		case BAN_SITE:
			send_to_pager("Banned sites:\n\r", ch);
			send_to_pager("[ #] Warn (Lv) Time                     By              For   Site\n\r", ch);
			send_to_pager("---- ---- ---- ------------------------ --------------- ----  ---------------\n\r", ch);
			pban = first_ban;
			set_pager_color( AT_PLAIN, ch );
			for ( bnum = 1; pban; pban = pban->next, bnum++)
			{
				if ( !pban->user )
					pager_printf (ch, "[%2d] %-4s (%2d) %-24s %-15s %4d  %c%s%c\n\r",
					              bnum, (pban->warn) ? "YES" : "no", pban->level,
					              pban->ban_time, pban->ban_by, pban->duration,
					              (pban->prefix) ? '*' : ' ',
					              pban->name, (pban->suffix) ? '*' : ' ');
				else
					pager_printf (ch, "[%2d] %-4s (%2d) %-24s %-15s %4d  %s@%c%s%c\n\r",
					              bnum, (pban->warn) ? "YES" : "no", pban->level,
					              pban->ban_time, pban->ban_by, pban->duration,
					              pban->user,
					              (pban->prefix) ? '*' : ' ',
					              pban->name, (pban->suffix) ? '*' : ' ');
			}
			return ;
		case BAN_RACE:
			send_to_pager("Banned races:\n\r", ch);
			send_to_pager("[ #] Warn (Lv) Time                     By              For   Race\n\r", ch);
			pban = first_ban_race;
			break;
		case BAN_CLASS:
			send_to_pager("Banned classes:\n\r", ch);
			send_to_pager("[ #] Warn (Lv) Time                     By              For   Class\n\r", ch);
			pban = first_ban_class;
			break;
		default:
			bug ("Bad type in show_bans: %d", type );
			return ;
	}
	send_to_pager("---- ---- ---- ------------------------ --------------- ----  ---------------\n\r", ch);
	set_pager_color( AT_PLAIN, ch );
	for ( bnum = 1; pban; pban = pban->next, bnum++)
		pager_printf (ch, "[%2d] %-4s (%2d) %-24s %-15s %4d  %s\n\r", bnum,
		              (pban->warn) ? "YES" : "no", pban->level, pban->ban_time, pban->ban_by,
		              pban->duration, pban->name);
	return ;
}

/*
 * Check for totally banned sites.  Need this because we don't have a
 * char struct yet.  Shaddai
 */

bool
check_total_bans ( DESCRIPTOR_DATA *d )
{
	BAN_DATA *pban;
	char new_host[MAX_STRING_LENGTH];
	int i;

	for ( i = 0; i < (int) strlen( d->host ) ; i++ )
		new_host[i] = LOWER( d->host[i] );
	new_host[i] = '\0';

	for ( pban = first_ban; pban; pban = pban->next )
	{
		if ( pban->level != LEVEL_SUPREME )
			continue;
		if ( pban->user && str_cmp( d->user, pban->user ) )
			continue;
		if ( pban->prefix && pban->suffix &&
		     strstr( pban->name, new_host ) )
		{
			if ( check_expire( pban ) )
			{
				dispose_ban( pban, BAN_SITE );
				save_banlist( );
				return false;
			}
			else
				return true;
		}
		/*
		 *   Bug of switched checks noticed by Cronel
		 */
		if ( pban->suffix && !str_prefix( pban->name, new_host ) )
		{
			if ( check_expire( pban ) )
			{
				dispose_ban( pban, BAN_SITE );
				save_banlist( );
				return false;
			}
			else
				return true;
		}
		if ( pban->prefix && !str_suffix( pban->name, new_host ) )
		{
			if ( check_expire( pban ) )
			{
				dispose_ban( pban, BAN_SITE );
				save_banlist( );
				return false;
			}
			else
				return true;
		}
		if ( !str_cmp( pban->name, new_host ) )
		{
			if ( check_expire( pban ) )
			{
				dispose_ban( pban, BAN_SITE );
				save_banlist( );
				return false;
			}
			else
				return true;
		}
	}
	return false;
}

/*
 * The workhose, checks for bans on sites/classes and races. Shaddai
 */

bool
check_bans( CHAR_DATA *ch, int type )
{
	char buf[MAX_STRING_LENGTH];
	BAN_DATA *pban;
	char new_host[MAX_STRING_LENGTH];
	int i;
	bool fMatch = false;

	switch ( type )
	{
		case BAN_RACE:
			pban = first_ban_race;
			break;
		case BAN_CLASS:
			pban = first_ban_class;
			break;
		case BAN_SITE:
			pban = first_ban;
			for ( i = 0; i < (int) ( strlen( ch->desc->host ) ); i++ )
				new_host[i] = LOWER( ch->desc->host[i] );
			new_host[i] = '\0';
			break;
		default:
			bug ( "Ban type in check_bans: %d.", type );
			return false;
	}
	for ( ; pban; pban = pban->next )
	{
		if ( type == BAN_CLASS && pban->flag == ch->class )
		{
			if ( check_expire( pban ) )
			{
				dispose_ban( pban, BAN_CLASS );
				save_banlist( );
				return false;
			}
			if ( ch->level > pban->level )
			{
				if ( pban->warn )
				{
					sprintf( buf, "%s class logging in from %s.",
					         pban->name, ch->desc->host );
					log_string_plus( buf, LOG_WARN, sysdata.log_level );
				}
				return false;
			}
			else
				return true;
		}
		if ( type == BAN_RACE && pban->flag == ch->race )
		{
			if ( check_expire( pban ) )
			{
				dispose_ban( pban, BAN_RACE );
				save_banlist( );
				return false;
			}
			if ( ch->level > pban->level )
			{
				if ( pban->warn )
				{
					sprintf( buf, "%s race logging in from %s.",
					         pban->name, ch->desc->host );
					log_string_plus( buf, LOG_WARN, sysdata.log_level );
				}
				return false;
			}
			else
				return true;
		}
		if ( type == BAN_SITE )
		{
			if ( pban->prefix && pban->suffix &&
			     strstr( pban->name, new_host ) )
				fMatch = true;
			else if ( pban->prefix && !str_suffix( pban->name, new_host ) )
				fMatch = true;
			else if ( pban->suffix && !str_prefix( pban->name, new_host ) )
				fMatch = true;
			else if ( !str_cmp( pban->name, new_host ) )
				fMatch = true;
			if ( fMatch && pban->user &&
			     str_cmp(pban->user, ch->desc->user) )
				fMatch = false;
			if ( fMatch )
			{
				if ( check_expire( pban ) )
				{
					dispose_ban( pban, BAN_SITE );
					save_banlist( );
					return false;
				}
				if ( ch->level > pban->level )
				{
					if ( pban->warn )
					{
						sprintf( buf, "%s logging in from site %s.",
						         ch->name, ch->desc->host );
						log_string_plus( buf, LOG_WARN, sysdata.log_level );
					}
					return false;
				}
				else
					return true;
			}
		}
	}
	return false;
}

bool check_expire( BAN_DATA *pban )
{
	char buf[MAX_STRING_LENGTH];

	if ( pban->unban_date < 0 )
		return false;
	if ( pban->unban_date <= current_time )
	{
		sprintf( buf, "%s ban has expired.", pban->name );
		log_string_plus( buf, LOG_WARN, sysdata.log_level );
		return true;
	}
	return false;
}

void dispose_ban ( BAN_DATA *pban , int type)
{
	if ( !pban )
		return ;

	if ( type != BAN_SITE && type != BAN_CLASS && type != BAN_RACE )
	{
		bug("Dispose_ban: Unknown Ban Type %d.", type );
		return ;
	}

	switch ( type )
	{
		case BAN_SITE:
			UNLINK(pban, first_ban, last_ban, next, prev);
			break;
		case BAN_CLASS:
			UNLINK(pban, first_ban_class, last_ban_class, next,
			       prev );
			break;
		case BAN_RACE:
			UNLINK(pban, first_ban_race, last_ban_race, next,
			       prev);
			break;
	}
	free_ban( pban );
	return ;
}

void free_ban( BAN_DATA *pban )
{
	if ( pban->name )
		DISPOSE( pban->name );
	if ( pban->ban_time )
		DISPOSE( pban->ban_time );
	if ( pban->note )
		STRFREE( pban->note );
	if ( pban->user )
		DISPOSE( pban->user );
	if ( pban->ban_by )
		DISPOSE( pban->ban_by );
	if ( pban->ban_time )
		DISPOSE( pban->ban_time );
	DISPOSE( pban );
}

M src/bet.h => src/bet.h +1 -4
@@ 147,10 147,7 @@ int parsebet (const int currentbet, char *s)
				else
					return( ( currentbet * ( 100 + atoi( s + 1 ) ) ) / 100 );
			}
/*			if ( s[1] == '\0' )
				return (currentbet * 125) / 100;
			return (currentbet * (100 + atoi(s + 1))) / 100;
*/		}
		}
		if ( s[0] == '*' || s[0] == 'x' ) /* multiply (default is by 2) */
		{
			if (s[1] == '\0')

M src/comm.c => src/comm.c +194 -265
@@ 99,6 99,8 @@ void 	mail_count(CHAR_DATA * ch);
void 	tax_player(CHAR_DATA * ch);
void 	mccp_interest(CHAR_DATA * ch);
bool 	check_total_ip(DESCRIPTOR_DATA * dnew);
bool	char_exists(char *fp);
bool 	check_pfile(DESCRIPTOR_DATA * d);
void 	usage(void);

/* locals */


@@ 613,6 615,7 @@ game_loop()
			if (FD_ISSET(d->descriptor, &exc_set)) {
				FD_CLR(d->descriptor, &in_set);
				FD_CLR(d->descriptor, &out_set);
				/* exceptional state, fquit */
				if (d->character) {
					log_string("preparing to fquit comm.c:652\n");
					fquit(d->character);


@@ 672,15 675,15 @@ game_loop()
					if (d->character)
						set_cur_char(d->character);
					switch (d->connected) {
					default:
						nanny(d, cmdline);
						break;
					case CON_PLAYING:
						interpret(d->character, cmdline);
						break;
					case CON_EDITING:
						edit_buffer(d->character, cmdline);
						break;
					default:
						nanny(d, cmdline);
						break;
					}
				}
			}


@@ 800,7 803,7 @@ new_descriptor(int new_desc)
	dnew->lines = 0;
	dnew->scrlen = 24;
	dnew->port = ntohs(sock.sin_port);
	dnew->user = STRALLOC("(unknown)");
	dnew->user = 0; 
	dnew->newstate = 0;
	dnew->prevcolor = 0x07;
	/* descriptor pipes */


@@ 1326,8 1329,9 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
	char   *pwdnew;
	char   *p;
	int 	b = 0;
	int 	iClass;
	int 	i_class;
	bool 	f_old;
	bool    p_exists;
	bool 	blocked = false;
	NOTE_DATA *catchup_notes;
	int 	i = 0;


@@ 1351,7 1355,6 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		}
		*argument = capitalize_string(argument);

		/* Old players can keep their characters. -- Alty */
		if (!check_parse_name(argument, (d->newstate != 0))) {
			send_to_desc_color("&wIllegal name, try another.\n\rName: &D", d);
			return;


@@ 1359,15 1362,6 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		if (!str_cmp(argument, "New") && !blocked) {
			if (d->newstate == 0) {
				/* new player */
				if (sysdata.DENY_NEW_PLAYERS == true) {
					sprintf(buf, "The mud is currently preparing for a reboot.\n\r");
					send_to_desc_color(buf, d);
					sprintf(buf, "New players are not accepted during this time.\n\r");
					send_to_desc_color(buf, d);
					sprintf(buf, "Please try again in a few minutes.\n\r");
					send_to_desc_color(buf, d);
					close_socket(d, false, false);
				}
				sprintf(buf, "\n\r&gChoosing a name is one of the most important parts of this game...\n\r"
				    "Make sure to pick a name appropriate to the character you are going\n\r"
				    "to role play, and be sure that it fits into the DragonBall Z world.\n\r"


@@ 1383,81 1377,36 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			}
		}
		if (!str_cmp(argument, "help")) {
			HELP_DATA *pHelp;
			HELP_DATA *p_help;

			for (pHelp = first_help; pHelp; pHelp = pHelp->next) {
				if (!str_cmp(pHelp->keyword, "dbznames"))
			for (p_help = first_help; p_help; p_help = p_help->next) {
				if (!str_cmp(p_help->keyword, "dbznames"))
					break;
			}
			if (!pHelp) {
			if (!p_help) {
				send_to_desc_color("No help on that word.\n\rName: ", d);
				return;
			}
			send_to_desc_color("\n\r", d);
			send_to_desc_color(pHelp->text, d);
			send_to_desc_color(p_help->text, d);
			send_to_desc_color("\n\r\n\r&wName: ", d);
			return;
		}
		/* brittle as fuck */
		f_old = load_char_obj(d, argument, true);
		if (f_old) {
			if (check_playing(d, argument)) {
				send_to_desc_color("&wPassword: &D", d);
				write_to_buffer(d, echo_off_str, 0);
				d->connected = CON_GET_OLD_PASSWORD;
				return;
			}
		}
		if (!d->character) {
			sprintf(log_buf, "Bad player file %s@%s.", argument, d->host);
			log_string(log_buf);
			send_to_desc_color("Your playerfile is corrupt... please notify case@capsulecorp.org\n\r", d);
			close_socket(d, false, false);
			return;
		}
		ch = d->character;
		if (check_bans(ch, BAN_SITE)) {
			send_to_desc_color("Your site has been banned from this Mud.\n\r", d);
			close_socket(d, false, true);
			return;
		}
		if (xIS_SET(ch->act, PLR_DENY)) {
			sprintf(log_buf, "Denying access to %s@%s.", argument, d->host);
			log_string_plus(log_buf, LOG_COMM, sysdata.log_level);
			if (d->newstate != 0) {
				send_to_desc_color("That name is already taken. Please choose another: ", d);
				d->connected = CON_GET_NAME;
				d->character->desc = NULL;
				free_char(d->character);
				d->character = NULL;
				return;
			}
			send_to_desc_color("You are denied access.\n\r", d);
			close_socket(d, false, true);
			return;
		}
		if (wizlock && ch->level < locklev) {
			send_to_desc_color("The game is wizlocked. Only immortals can connect now.\n\r", d);
			send_to_desc_color("Please try back later.\n\r", d);
			close_socket(d, false, true);
			return;
		}
		if (f_old) {
			if (d->newstate != 0) {
		p_exists  = char_exists(argument);
		if (p_exists) {
			    send_to_desc_color("&wPassword: &D", d);
			    write_to_buffer(d, echo_off_str, 0);
			    d->user = *argument;
			    d->connected = CON_GET_OLD_PASSWORD;
			    return;
		} else if (p_exists && d->newstate != 0) {
				send_to_desc_color("&wThat name is already taken. Please choose another: &D", d);
				d->connected = CON_GET_NAME;
				d->character->desc = NULL;
				free_char(d->character);
				d->character = NULL;
				return;
			}
			/* old player */
			send_to_desc_color("&wPassword: &D", d);
			write_to_buffer(d, echo_off_str, 0);
			d->connected = CON_GET_OLD_PASSWORD;
			return;
		} else {
			if (d->newstate == 0) {
		} else if (d->newstate == 0) {
				/* no such player */
				send_to_desc_color("\n\r&wNo such player exists.\n\rPlease check your spelling, or type new to start a new player.\n\r\n\rName: &D", d);
				d->connected = CON_GET_NAME;


@@ 1465,7 1414,7 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
				free_char(d->character);
				d->character = NULL;
				return;
			}
		} else {
			sprintf(buf, "&wDid I get that right, %s (&WY&w/&WN&w)? &D", argument);
			send_to_desc_color(buf, d);
			d->connected = CON_CONFIRM_NEW_NAME;


@@ 1473,6 1422,11 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		}
		break;
	case CON_GET_OLD_PASSWORD:
		/* player exists, load in character */
		f_old = load_char_obj(d, buf, false);
		if (!check_pfile(d)) {
			return;
		}
		write_to_buffer(d, "\n\r", 2);
		if (str_cmp(sha256_crypt(argument), ch->pcdata->pwd)) {
			write_to_buffer(d, "Wrong password, disconnecting.\n\r", 0);


@@ 1490,9 1444,7 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		}
		strncpy(buf, ch->pcdata->filename, MAX_STRING_LENGTH);
		d->character->desc = NULL;
		free_char(d->character);
		d->character = NULL;
		f_old = load_char_obj(d, buf, false);
		ch = d->character;
		if (ch->position > POS_SITTING && ch->position < POS_STANDING)
			ch->position = POS_STANDING;


@@ 1523,7 1475,7 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			pager_printf(ch, "Updated player data successfully.\n\r");
		else
			pager_printf(ch, "No updates to make.\n\r");
		adjust_hiscore("pkill", ch, ch->pcdata->pkills);	/* cronel hiscore */
		adjust_hiscore("pkill", ch, ch->pcdata->pkills);
		adjust_hiscore("sparwins", ch, ch->pcdata->spar_wins);
		adjust_hiscore("sparloss", ch, ch->pcdata->spar_loss);
		adjust_hiscore("mkills", ch, ch->pcdata->mkills);


@@ 1533,7 1485,6 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		adjust_hiscore("zeni", ch, ch->gold);
		adjust_hiscore("bounty", ch, ch->pcdata->bkills);
		update_member(ch);

		show_title(d);
		break;
	case CON_CONFIRM_NEW_NAME:


@@ 1568,14 1519,13 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			send_to_desc_color("&wPassword must be at least five characters long.\n\rPassword: &D", d);
			return;
		}
		pwdnew = sha256_crypt(argument);	/* SHA256 Encryption */
		pwdnew = sha256_crypt(argument);
		for (p = pwdnew; *p != '\0'; p++) {
			if (*p == '~') {
				send_to_desc_color("&wNew password not acceptable, try again.\n\rPassword: &D", d);
				return;
			}
		}

		DISPOSE(ch->pcdata->pwd);
		ch->pcdata->pwd = str_dup(pwdnew);
		send_to_desc_color("\n\r&wPlease retype the password to confirm: &D", d);


@@ 1638,18 1588,18 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		break;
	case CON_GET_HC:
		if (!str_cmp(argument, "help")) {
			HELP_DATA *pHelp;
			HELP_DATA *p_help;

			for (pHelp = first_help; pHelp; pHelp = pHelp->next) {
				if (!str_cmp(pHelp->keyword, "HC HARDCORE UNKNOWN"))
			for (p_help = first_help; p_help; p_help = p_help->next) {
				if (!str_cmp(p_help->keyword, "HC HARDCORE UNKNOWN"))
					break;
			}
			if (!pHelp) {
			if (!p_help) {
				send_to_desc_color("No help on that word.\n\rDo you wish to be a &RHARDCORE&w character? (&WY&w/&WN&w): ", d);
				return;
			}
			send_to_desc_color("\n\r", d);
			send_to_desc_color(pHelp->text, d);
			send_to_desc_color(p_help->text, d);
			send_to_desc_color("&wDo you wish to be a &RHARDCORE&w character? (&WY&w/&WN&w): ", d);
			return;
		}


@@ 1701,18 1651,18 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		/* Take this out SHADDAI */
		i = 0;
		send_to_desc_color("\n\r", d);
		for (iClass = 0; iClass < 31; iClass++) {
			if (iClass == 4) {
		for (i_class = 0; i_class < 31; i_class++) {
			if (i_class == 4) {
				continue;
			}
			if (iClass > 8 && iClass < 28)
			if (i_class > 8 && i_class < 28)
				continue;
			char 	letters[14] = "abcdefghijklmn";

			if (class_table[iClass]->who_name &&
			    class_table[iClass]->who_name[0] != '\0') {
			if (class_table[i_class]->who_name &&
			    class_table[i_class]->who_name[0] != '\0') {
				sprintf(buf, "&w   (&W%2d&w)  &c%-12s&w  ('&R%c&w' for help)&D\n\r",
				    i, class_table[iClass]->who_name, letters[i]);
				    i, class_table[i_class]->who_name, letters[i]);
				send_to_desc_color(buf, d);
				i++;
			}


@@ 1723,60 1673,52 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		d->connected = CON_GET_NEW_CLASS;
		break;
	case CON_GET_NEW_CLASS:
		argument = one_argument(argument, arg);
		if (is_number(arg)) {
			i = atoi(arg);
			int 	c = 0;

			if (i == 0)
				c = 0;
			//saian
			    if (i == 1)
				c = 1;
			//human
			    if (i == 2)
				c = 2;
			//halfbreed
			    if (i == 3)
				c = 3;
			//namek
			    if (i == 4)
				c = 5;
			//icer
			    if (i == 5)
				c = 6;
			//bio
			    if (i == 6)
				c = 7;
			//kaio
			    if (i == 7)
				c = 8;
			//demon
			    if (i == 8)
				c = 28;
			//android - h
			    if (i == 9)
				c = 29;
			//android - e
			    if (i == 10)
				c = 30;
			//android - fm
			    for (iClass = 0; iClass < 31; iClass++) {
				if (iClass > 8 && iClass < 28)
					continue;
				if (class_table[iClass]->who_name &&
				    class_table[iClass]->who_name[0] != '\0') {
					if (c == iClass) {
						ch->class = iClass;
						ch->race = iClass;
						break;
					}
				}
			}
		} else {
			char 	letters[14] = "abcdefghijklmn";

			for (i = 0; i < 14; i++) {
	     /* 1 - saiyan, 2 - human, 3 - halfie, 4 - namek, 5 - icer, 
	      * 6 - bio, 7 - kaio, 8 - demon, 9 - android-h, 
	      * 10 - android-e, 11 - android-fm
	      */
	     argument = one_argument(argument, arg);
	     if (is_number(arg)) {
		  i = atoi(arg);
		  int 	c = 0;

		  if (i == 0)
		       c = 0;
		  if (i == 1)
		       c = 1;
		  if (i == 2)
		       c = 2;
		  if (i == 3)
		       c = 3;
		  if (i == 4)
		       c = 5;
		  if (i == 5)
		       c = 6;
		  if (i == 6)
		       c = 7;
		  if (i == 7)
		       c = 8;
		  if (i == 8)
		       c = 28;
		  if (i == 9)
		       c = 29;
		  if (i == 10)
		       c = 30;
		  for (i_class = 0; i_class < 31; i_class++) {
		       if (i_class > 8 && i_class < 28)
			    continue;
		       if (class_table[i_class]->who_name &&
			 class_table[i_class]->who_name[0] != '\0') {
			    if (c == i_class) {
				 ch->class = i_class;
				 ch->race = i_class;
				 break;
			    }
		       }
		  }
	     } else {
		  char 	letters[14] = "abcdefghijklmn";
		  for (i = 0; i < 14; i++) {
				if (arg[0] == letters[i]) {
					int 	c = i;



@@ 1827,19 1769,19 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			}
			i = 0;
			send_to_desc_color("\n\r&c==============================================================================&D", d);
			for (iClass = 0; iClass < 31; iClass++) {
				if (iClass == 4) {
			for (i_class = 0; i_class < 31; i_class++) {
				if (i_class == 4) {
					continue;
				}
				if (iClass > 8 && iClass < 28)
				if (i_class > 8 && i_class < 28)
					continue;
				char 	letters[14] = "abcdefghijklmn";

				if (class_table[iClass]->who_name &&
				    class_table[iClass]->who_name[0] != '\0') {
				if (class_table[i_class]->who_name &&
				    class_table[i_class]->who_name[0] != '\0') {
					sprintf(buf, "\n\r&w   (&W%2d&w)  &c%-12s&w  ('&R%c&w' for help)&D",
					    i,
					    class_table[iClass]->who_name, letters[i]);
					    class_table[i_class]->who_name, letters[i]);
					send_to_desc_color(buf, d);
					i++;
				}


@@ 1850,19 1792,14 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			return;
		}

		if (iClass != 28 && iClass != 29 && iClass != 30)
			if (iClass > 8
			    || !class_table[iClass]->who_name
			    || class_table[iClass]->who_name[0] == '\0'
			    || !str_cmp(class_table[iClass]->who_name, "unused")) {
		if (i_class != 28 && i_class != 29 && i_class != 30)
			if (i_class > 8
			    || !class_table[i_class]->who_name
			    || class_table[i_class]->who_name[0] == '\0'
			    || !str_cmp(class_table[i_class]->who_name, "unused")) {
				send_to_desc_color("&wThat's not a race.\n\rWhat IS your race? &D", d);
				return;
			}
		if (check_bans(ch, BAN_CLASS)) {
			send_to_desc_color(
			    "&wThat race is not currently avaiable.\n\rWhat IS your race? &D", d);
			return;
		}
		if (ch->race == 3 || ch->race == 5 || ch->race == 6) {
			ch->pcdata->haircolor = 24;
			ch->pcdata->orignalhaircolor = 24;


@@ 1870,8 1807,8 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			send_to_desc_color("\n\r&wPlease choose a hair color from the following list:&D\n\r", d);
			buf[0] = '\0';

			for (iClass = 0; iClass < (MAX_HAIR - 2); iClass++) {
				sprintf(buf2, "&w[&W%2d&w] &g%-18.18s  ", iClass, hair_color[iClass]);
			for (i_class = 0; i_class < (MAX_HAIR - 2); i_class++) {
				sprintf(buf2, "&w[&W%2d&w] &g%-18.18s  ", i_class, hair_color[i_class]);
				b++;
				strcat(buf, buf2);
				if ((b % 3) == 0)


@@ 1891,20 1828,20 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
				send_to_desc_color("&wPlease choose a hair color: &D", d);
				return;
			}
			for (iClass = 0; iClass < (MAX_HAIR - 2); iClass++) {
				if (toupper(arg[0]) == toupper(hair_color[iClass][0])
				    && !str_prefix(arg, hair_color[iClass])) {
					ch->pcdata->haircolor = iClass;
					ch->pcdata->orignalhaircolor = iClass;
			for (i_class = 0; i_class < (MAX_HAIR - 2); i_class++) {
				if (toupper(arg[0]) == toupper(hair_color[i_class][0])
				    && !str_prefix(arg, hair_color[i_class])) {
					ch->pcdata->haircolor = i_class;
					ch->pcdata->orignalhaircolor = i_class;
					break;
				}
				if (is_number(arg) && atoi(arg) == iClass) {
					ch->pcdata->haircolor = iClass;
					ch->pcdata->orignalhaircolor = iClass;
				if (is_number(arg) && atoi(arg) == i_class) {
					ch->pcdata->haircolor = i_class;
					ch->pcdata->orignalhaircolor = i_class;
					break;
				}
			}
			if (iClass == (MAX_HAIR - 2) || !hair_color[iClass] || hair_color[iClass][0] == '\0') {
			if (i_class == (MAX_HAIR - 2) || !hair_color[i_class] || hair_color[i_class][0] == '\0') {
				send_to_desc_color("&wThat's not a hair color.\n\rWhat IS it going to be? &D", d);
				return;
			}


@@ 1914,8 1851,8 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			buf[0] = '\0';
			buf2[0] = '\0';
			b = 0;
			for (iClass = (MAX_COMPLEXION - 17); iClass < (MAX_COMPLEXION - 14); iClass++) {
				sprintf(buf2, "&w[&W%2d&W] &g%-15s&D", iClass, complexion[iClass]);
			for (i_class = (MAX_COMPLEXION - 17); i_class < (MAX_COMPLEXION - 14); i_class++) {
				sprintf(buf2, "&w[&W%2d&W] &g%-15s&D", i_class, complexion[i_class]);
				b++;
				strcat(buf, buf2);
				if ((b % 4) == 0)


@@ 1931,8 1868,8 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			buf[0] = '\0';
			buf2[0] = '\0';
			b = 0;
			for (iClass = (MAX_COMPLEXION - 14); iClass < (MAX_COMPLEXION); iClass++) {
				sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", iClass, complexion[iClass]);
			for (i_class = (MAX_COMPLEXION - 14); i_class < (MAX_COMPLEXION); i_class++) {
				sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", i_class, complexion[i_class]);
				b++;
				strcat(buf, buf2);
				if ((b % 4) == 0)


@@ 1948,8 1885,8 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			buf[0] = '\0';
			buf2[0] = '\0';
			b = 0;
			for (iClass = 0; iClass < (MAX_COMPLEXION - 17); iClass++) {
				sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", iClass, complexion[iClass]);
			for (i_class = 0; i_class < (MAX_COMPLEXION - 17); i_class++) {
				sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", i_class, complexion[i_class]);
				b++;
				strcat(buf, buf2);
				if ((b % 4) == 0)


@@ 1969,18 1906,18 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
				send_to_desc_color("&wPlease choose a main body color: &D", d);
				return;
			}
			for (iClass = (MAX_COMPLEXION - 14); iClass < (MAX_COMPLEXION); iClass++) {
				if (toupper(arg[0]) == toupper(complexion[iClass][0])
				    && !str_prefix(arg, complexion[iClass])) {
					ch->pcdata->complexion = iClass;
			for (i_class = (MAX_COMPLEXION - 14); i_class < (MAX_COMPLEXION); i_class++) {
				if (toupper(arg[0]) == toupper(complexion[i_class][0])
				    && !str_prefix(arg, complexion[i_class])) {
					ch->pcdata->complexion = i_class;
					break;
				}
				if (is_number(arg) && atoi(arg) == iClass) {
					ch->pcdata->complexion = iClass;
				if (is_number(arg) && atoi(arg) == i_class) {
					ch->pcdata->complexion = i_class;
					break;
				}
			}
			if (iClass == (MAX_COMPLEXION) || !complexion[iClass] || complexion[iClass][0] == '\0') {
			if (i_class == (MAX_COMPLEXION) || !complexion[i_class] || complexion[i_class][0] == '\0') {
				send_to_desc_color("&wThat's not a choice.\n\rWhat IS it going to be? &D", d);
				return;
			}


@@ 1990,18 1927,18 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
				send_to_desc_color("&wPlease choose a main body color: &D", d);
				return;
			}
			for (iClass = (MAX_COMPLEXION - 17); iClass < (MAX_COMPLEXION - 13); iClass++) {
				if (toupper(arg[0]) == toupper(complexion[iClass][0])
				    && !str_prefix(arg, complexion[iClass])) {
					ch->pcdata->complexion = iClass;
			for (i_class = (MAX_COMPLEXION - 17); i_class < (MAX_COMPLEXION - 13); i_class++) {
				if (toupper(arg[0]) == toupper(complexion[i_class][0])
				    && !str_prefix(arg, complexion[i_class])) {
					ch->pcdata->complexion = i_class;
					break;
				}
				if (is_number(arg) && atoi(arg) == iClass) {
					ch->pcdata->complexion = iClass;
				if (is_number(arg) && atoi(arg) == i_class) {
					ch->pcdata->complexion = i_class;
					break;
				}
			}
			if (iClass == (MAX_COMPLEXION - 14) || !complexion[iClass] || complexion[iClass][0] == '\0') {
			if (i_class == (MAX_COMPLEXION - 14) || !complexion[i_class] || complexion[i_class][0] == '\0') {
				send_to_desc_color("&wThat's not a choice.\n\rWhat IS it going to be? &D", d);
				return;
			}


@@ 2011,18 1948,18 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
				send_to_desc_color("&wPlease choose complexion: &D", d);
				return;
			}
			for (iClass = 0; iClass < (MAX_COMPLEXION - 17); iClass++) {
				if (toupper(arg[0]) == toupper(complexion[iClass][0])
				    && !str_prefix(arg, complexion[iClass])) {
					ch->pcdata->complexion = iClass;
			for (i_class = 0; i_class < (MAX_COMPLEXION - 17); i_class++) {
				if (toupper(arg[0]) == toupper(complexion[i_class][0])
				    && !str_prefix(arg, complexion[i_class])) {
					ch->pcdata->complexion = i_class;
					break;
				}
				if (is_number(arg) && atoi(arg) == iClass) {
					ch->pcdata->complexion = iClass;
				if (is_number(arg) && atoi(arg) == i_class) {
					ch->pcdata->complexion = i_class;
					break;
				}
			}
			if (iClass == (MAX_COMPLEXION - 17) || !complexion[iClass] || complexion[iClass][0] == '\0') {
			if (i_class == (MAX_COMPLEXION - 17) || !complexion[i_class] || complexion[i_class][0] == '\0') {
				send_to_desc_color("&wThat's not a complexion.\n\rWhat IS it going to be? &D", d);
				return;
			}


@@ 2032,8 1969,8 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			buf[0] = '\0';
			buf2[0] = '\0';
			b = 0;
			for (iClass = 0; iClass < (MAX_SECONDARYCOLOR - 1); iClass++) {
				sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", iClass, secondary_color[iClass]);
			for (i_class = 0; i_class < (MAX_SECONDARYCOLOR - 1); i_class++) {
				sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", i_class, secondary_color[i_class]);
				b++;
				strcat(buf, buf2);
				if ((b % 4) == 0)


@@ 2057,18 1994,18 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
				send_to_desc_color("&wPlease choose a secondary body color: &D", d);
				return;
			}
			for (iClass = 0; iClass < (MAX_SECONDARYCOLOR - 1); iClass++) {
				if (toupper(arg[0]) == toupper(secondary_color[iClass][0])
				    && !str_prefix(arg, secondary_color[iClass])) {
					ch->pcdata->secondarycolor = iClass;
			for (i_class = 0; i_class < (MAX_SECONDARYCOLOR - 1); i_class++) {
				if (toupper(arg[0]) == toupper(secondary_color[i_class][0])
				    && !str_prefix(arg, secondary_color[i_class])) {
					ch->pcdata->secondarycolor = i_class;
					break;
				}
				if (is_number(arg) && atoi(arg) == iClass) {
					ch->pcdata->secondarycolor = iClass;
				if (is_number(arg) && atoi(arg) == i_class) {
					ch->pcdata->secondarycolor = i_class;
					break;
				}
			}
			if (iClass == (MAX_SECONDARYCOLOR - 1) || !secondary_color[iClass] || secondary_color[iClass][0] == '\0') {
			if (i_class == (MAX_SECONDARYCOLOR - 1) || !secondary_color[i_class] || secondary_color[i_class][0] == '\0') {
				send_to_desc_color("&wThat's not a choice.\n\rWhat IS it going to be? &D", d);
				return;
			}


@@ 2078,8 2015,8 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		buf2[0] = '\0';
		b = 0;

		for (iClass = 0; iClass < (MAX_EYE - 3); iClass++) {
			sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", iClass, eye_color[iClass]);
		for (i_class = 0; i_class < (MAX_EYE - 3); i_class++) {
			sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", i_class, eye_color[i_class]);
			b++;
			strcat(buf, buf2);
			if ((b % 4) == 0)


@@ 2102,20 2039,20 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			send_to_desc_color("&wPlease choose a hair color: &D", d);
			return;
		}
		for (iClass = 0; iClass < (MAX_EYE - 3); iClass++) {
			if (toupper(arg[0]) == toupper(eye_color[iClass][0])
			    && !str_prefix(arg, eye_color[iClass])) {
				ch->pcdata->eyes = iClass;
				ch->pcdata->orignaleyes = iClass;
		for (i_class = 0; i_class < (MAX_EYE - 3); i_class++) {
			if (toupper(arg[0]) == toupper(eye_color[i_class][0])
			    && !str_prefix(arg, eye_color[i_class])) {
				ch->pcdata->eyes = i_class;
				ch->pcdata->orignaleyes = i_class;
				break;
			}
			if (is_number(arg) && atoi(arg) == iClass) {
				ch->pcdata->eyes = iClass;
				ch->pcdata->orignaleyes = iClass;
			if (is_number(arg) && atoi(arg) == i_class) {
				ch->pcdata->eyes = i_class;
				ch->pcdata->orignaleyes = i_class;
				break;
			}
		}
		if (iClass == (MAX_EYE - 3) || !eye_color[iClass] || eye_color[iClass][0] == '\0') {
		if (i_class == (MAX_EYE - 3) || !eye_color[i_class] || eye_color[i_class][0] == '\0') {
			send_to_desc_color("&wThat's not a eye color.\n\rWhat IS it going to be? &D", d);
			return;
		}


@@ 2124,8 2061,8 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		buf2[0] = '\0';
		b = 0;

		for (iClass = 0; iClass < (MAX_BUILD); iClass++) {
			sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", iClass, build_type[iClass]);
		for (i_class = 0; i_class < (MAX_BUILD); i_class++) {
			sprintf(buf2, "&w[&W%2d&w] &g%-15s&D", i_class, build_type[i_class]);
			b++;
			strcat(buf, buf2);
			if ((b % 4) == 0)


@@ 2138,28 2075,24 @@ nanny(DESCRIPTOR_DATA * d, char *argument)

		break;
	case CON_GET_NEW_BUILD:
		/*
		 * Black, Brown, Red, Blonde, Strawberry Blonde, Argent,
		 * Golden Blonde, Platinum Blonde, Light Brown
		 */
		argument = one_argument(argument, arg);
		if (!str_cmp(arg, "help")) {
			do_help(ch, argument);
			send_to_desc_color("&wPlease choose a build type: &D", d);
			return;
		}
		for (iClass = 0; iClass < (MAX_BUILD); iClass++) {
			if (toupper(arg[0]) == toupper(build_type[iClass][0])
			    && !str_prefix(arg, build_type[iClass])) {
				ch->pcdata->build = iClass;
		for (i_class = 0; i_class < (MAX_BUILD); i_class++) {
			if (toupper(arg[0]) == toupper(build_type[i_class][0])
			    && !str_prefix(arg, build_type[i_class])) {
				ch->pcdata->build = i_class;
				break;
			}
			if (is_number(arg) && atoi(arg) == iClass) {
				ch->pcdata->build = iClass;
			if (is_number(arg) && atoi(arg) == i_class) {
				ch->pcdata->build = i_class;
				break;
			}
		}
		if (iClass == (MAX_BUILD) || !build_type[iClass] || build_type[iClass][0] == '\0') {
		if (i_class == (MAX_BUILD) || !build_type[i_class] || build_type[i_class][0] == '\0') {
			send_to_desc_color("&wThat's not a build type.\n\rWhat IS it going to be? &D", d);
			return;
		}


@@ 2185,14 2118,12 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		return;
		break;
	case CON_PRESS_ENTER:
		if (chk_watch(get_trust(ch), ch->name, d->host))	/* --Gorog */
		if (chk_watch(get_trust(ch), ch->name, d->host))
			SET_BIT(ch->pcdata->flags, PCFLAG_WATCH);
		else
			REMOVE_BIT(ch->pcdata->flags, PCFLAG_WATCH);

		if (ch->position == POS_MOUNTED)
			ch->position = POS_STANDING;

		set_pager_color(AT_PLAIN, ch);
		if (xIS_SET(ch->act, PLR_RIP))
			send_rip_screen(ch);


@@ 2214,7 2145,6 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
	case CON_READ_MOTD:
		{
			char 	motdbuf[MAX_STRING_LENGTH];

			sprintf(motdbuf, "\n\rWelcome to %s...\n\r", sysdata.mud_name);
			send_to_desc_color(motdbuf, d);
		}


@@ 2225,7 2155,6 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			d->ansi = false;
		else if (xIS_SET(ch->act, PLR_ANSI) && d->ansi == false)
			d->ansi = true;

		if (ch->level == 0) {
			int 	i_lang;



@@ 2322,11 2251,6 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
				ch->pcdata->natural_ac_max = 500;
			if (is_bio(ch))
				ch->pcdata->absorb_pl_mod = 6;

			/*
			 * To make it so that saiyans and halfies start out
			 * with the Oozaru mouth cannon. -Karma
			 */
			if (is_saiyan(ch) || is_hb(ch))
				ch->pcdata->learned[gsn_monkey_gun] = 95;



@@ 2336,11 2260,6 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			set_title(ch, buf);
			ch->pcdata->creation_date = current_time;

			/*
			 * Added by Narn.  Start new characters with
			 * autoexit and autgold already turned on.  Very few
			 * people don't use those.
			 */
			xSET_BIT(ch->act, PLR_AUTOGOLD);
			xSET_BIT(ch->act, PLR_AUTOEXIT);
			xSET_BIT(ch->act, PLR_AUTO_COMPASS);


@@ 2348,11 2267,6 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
			SET_BIT(ch->pcdata->flags, PCFLAG_DEADLY);
			xSET_BIT(ch->deaf, CHANNEL_FOS);


			/*
			 * Don't display old notes as 'unread' except for
			 * the announcment board
			 */
			for (i = 1; i < MAX_BOARD; i++) {
				for (catchup_notes = ch->pcdata->board->note_first; catchup_notes && catchup_notes->next; catchup_notes = catchup_notes->next);



@@ 2408,7 2322,6 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		ch->logon_start = ch->exp;
		do_global_boards(ch, "");


		ch->dodge = false;
		ch->block = false;
		ch->ki_dodge = false;


@@ 2433,7 2346,7 @@ nanny(DESCRIPTOR_DATA * d, char *argument)
		break;
	case CON_NOTE_SUBJECT:
		handle_con_note_subject(d, argument);
		break;			/* subject */
		break;			
	case CON_NOTE_EXPIRE:
		handle_con_note_expire(d, argument);
		break;


@@ 2503,12 2416,6 @@ check_parse_name(char *name, bool newchar)
			return (false);
	}

	/*
         * Code that followed here used to prevent players from naming
         * themselves after mobs... this caused much havoc when new areas
         * would go in...
         */

	return (true);
}



@@ 4249,13 4156,35 @@ act2(sh_int AType, const char *format, CHAR_DATA * ch, const void *arg1, const v
			}
		}
		if (MOBtrigger) {
			/*
			 * Note: use original string, not string with ANSI.
			 * -- Alty
			 */
			mprog_act_trigger(txt, to, ch, (OBJ_DATA *) arg1, (void *) arg2);
		}
	}
	MOBtrigger = true;
	return;
}

bool
char_exists(char *fp) {
     char pl[MAX_STRING_LENGTH];
 
     sprintf(pl, "%s%c/%s", PLAYER_DIR, tolower(fp[0]), capitalize(fp));

     if(access(pl, F_OK) != -1 ) {
	  return (true);
     } else {
	  return (false);
     }
}

bool
check_pfile(DESCRIPTOR_DATA * d) {
     if (!d->character) {
	  sprintf(log_buf, "Bad player file %s", d->user);
	  log_string(log_buf);
	  send_to_desc_color("Your playerfile is corrupt... please notify case@capsulecorp.org\n\r", d);
	  close_socket(d, false, false);
	  return (false);
     } else {
	  return(true);
     }
}

D src/commands => src/commands +0 -20
@@ 1,20 0,0 @@
bt
frame 0
list
info locals
frame 1
list
info locals
frame 2
list
info locals
frame 3
list
info locals
frame 4
list
info locals
frame 5
list
info locals


D src/imm_host.c => src/imm_host.c +0 -369
@@ 1,369 0,0 @@
/****************************************************************************
 * [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame      |   \\._.//   *
 * -----------------------------------------------------------|   (0...0)   *
 * SMAUG 1.4 (C) 1994, 1995, 1996, 1998  by Derek Snider      |    ).:.(    *
 * -----------------------------------------------------------|    {o o}    *
 * SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus,      |   / ' ' \   *
 * Scryn, Rennard, Swordbearer, Gorog, Grishnakh, Nivek,      |~'~.VxvxV.~'~*
 * Tricops and Fireblade                                      |             *
 * ------------------------------------------------------------------------ *
 * Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael        *
 * Chastain, Michael Quan, and Mitchell Tse.                                *
 * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,          *
 * Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.     *
 * ------------------------------------------------------------------------ *
 *                        Immortal Host module by Shaddai                   *
 ****************************************************************************/

#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdbool.h>
#include "mud.h"


/*
 * This loads the Immortal host data structure to keep certain immortals
 * from logging on from certain sites...  IE keep hackers out of the high
 * level immortals.  Shaddai July 27, 1997
 */

#if defined(KEY)
#undef KEY
#endif

#define KEY( literal, field, value )                                    \
                                if ( !str_cmp( word, literal ) )        \
                                {                                       \
                                    field  = value;                     \
                                    fMatch = true;                      \
                                    break;                              \
                                }


int
load_imm_host ( ) 
{
  FILE *fp;
  char *word;
  char buf[MAX_STRING_LENGTH];
  bool my_continue = true;
  bool fMatch = false;
  IMMORTAL_HOST *host;


  if ( ( fp = fopen ( IMM_HOST_FILE, "r" ) ) == NULL )
  {
	log_string ("No immortal host data" );
	return rNONE;
  }

  while ( my_continue )
  {
     word = feof (fp) ? "#END" : fread_word (fp);
     fMatch = false;

     switch ( UPPER ( word[0] ) )
     {
	case '#':
		if ( !str_cmp ( word, "#END") )
		{
		 fclose ( fp );
		 fMatch = true;
		 my_continue = false;
		 } 
		 break;
	case 'S':
		if ( !str_cmp ( word, "Start") )
		{
                 CREATE ( host, IMMORTAL_HOST, 1 );
		 LINK( host, immortal_host_start, immortal_host_end,
				next, prev );
		 fread_imm_host( fp, host );
		 fMatch = true;
		}
		break;
     }

     if ( !fMatch )
     {
	sprintf ( buf, "Load_imm_host: no match: %s", word );
	bug ( buf, 0 );
     }
  }
  log_string ("Done.");
  return rNONE;
}


/* 
 * This function reads one immortal host to a file.
 * Shaddai  July 27, 1997
 */

int
fread_imm_host ( FILE *fp , IMMORTAL_HOST *data )
{
  char buf[MAX_STRING_LENGTH];
  char *word;
  bool fMatch;
  int temp;

  for ( ; ; )
  {
    word = feof (fp) ? "End" : fread_word (fp);
    fMatch = false; 

    switch ( UPPER ( word[0] ) )
    {
        case 'E':
	  if ( !str_cmp( word, "End" ) )
		return rNONE;
	case 'H': 
	  KEY ("Host", data->host, fread_string_nohash (fp) );
	  break;
	case 'N':
	  KEY ("Name", data->name, fread_string_nohash ( fp ) );
	  break;
	case 'P':
	  if ( !str_cmp( word, "Prefix" ) ) 
	  {
		temp = fread_number ( fp );
		if ( temp )
			data->prefix = true;
		else
			data->prefix = false;
		fMatch = true;
	  }	
	  break;
	case 'S':
	  if ( !str_cmp( word, "Suffix" ) ) 
	  {
		temp = fread_number ( fp );
		if ( temp )
			data->suffix = true;
		else
			data->suffix = false;
		fMatch = true;
	  }	
	  break;
     }
     if (!fMatch)
     {
	sprintf (buf, "Fread_immortal_host: no match: %s", word );
	bug ( buf, 0 );
     }
  }
  return rNONE;
}

bool
check_immortal_domain( CHAR_DATA *ch, char *host )
{
  bool found = false;
  IMMORTAL_HOST * temp;
  char my_host[MAX_STRING_LENGTH];
  char my_name[MAX_STRING_LENGTH];
  int i = 0;

  for ( i = 0; i <  strlen( host ); i++ )
  	my_host[i] = LOWER( host[i] );
  my_host[i] = '\0';

  for ( i = 0; i < strlen( ch->name ); i++ )
        my_name[i] = LOWER( ch->name[i] );
  my_name[i] = '\0';

  for ( temp = immortal_host_start; temp; temp = temp->next )
  {
        if ( !str_cmp ( my_name, strlower(temp->name) ) )
        {
                found = true;
                if ( temp->prefix && temp->suffix 
			&& strstr( temp->host, my_host))
                        return true;
                else if ( temp->prefix 
			&& !str_suffix( temp->host, my_host))
                        return true;
                else if ( temp->suffix 
			&& !str_prefix( temp->host, my_host))
                        return true;
		else if ( !str_cmp( temp->host, my_host))
		{
			return true;
		}
        }
  }

  if ( !found )
        return true;
  else
  	return false;
}

void
do_add_imm_host ( CHAR_DATA *ch, char *argument )
{
  char type[MAX_INPUT_LENGTH];
  char arg1[MAX_INPUT_LENGTH];
  char arg2[MAX_INPUT_LENGTH];
  char *arg3 = NULL;
  char *name;
  IMMORTAL_HOST *temp, *host;

  argument = one_argument(argument, type );
  argument = one_argument(argument, arg1 );
  argument = one_argument(argument, arg2 );

  set_char_color( AT_IMMORT, ch );

  if ( type[0] == '\0' )
  {
        if ( immortal_host_start == NULL )
        {
  	   send_to_char("No immortals are protected at this time.\n\r",ch );
	   return;
	}
	send_to_char("Immortal   Host\n\r", ch);
	set_char_color( AT_PLAIN, ch );
        for ( temp = immortal_host_start ; temp ; temp = temp->next )	
	  ch_printf ( ch, "%-8s  %c%s%c\n\r",
		temp->name, (temp->prefix?'*':' '), temp->host,
		(temp->suffix?'*':' ') );
	return;
  }
  
  /* Ok we have a new entry make sure it doesn't contain a ~ */

  if ( !str_cmp( type, "save" ) )
  {
	do_write_imm_host( );
	send_to_char( "Done.\n\r", ch );
	return;
  }

  if ( arg2[0] == '\0' || arg1[0] == '\0' )
  {
	send_to_char ("Syntax: immhost add    <name> <host>\n\r", ch );
	send_to_char ("Syntax: immhost delete <name> <host>\n\r", ch );
	send_to_char ("Syntax: immhost save\n\r", ch );
	return;
  }

  if ( !str_cmp( type, "delete" ) )
  {
	IMMORTAL_HOST  *it = NULL;

	arg3 = arg2;
	if ( arg3[0] == '*' )
		arg3++;
	if ( arg3[strlen(arg3) -1] == '*' )
		arg3[strlen(arg3)-1] = '\0';

        for ( temp = immortal_host_start ; temp ; temp = temp->next )	
	{
		if ( !str_cmp ( arg1, temp->name ) 
			&& !str_cmp ( arg3, temp->host ) )
		{
			it = temp;
			break;
		}
	}
	if ( it == NULL )
	{
		send_to_char ("Didn't find that entry.\n\r", ch );
		return;
	}
        DISPOSE ( temp->name );
        DISPOSE ( temp->host );
	UNLINK ( it, immortal_host_start, immortal_host_end, next, prev);
	DISPOSE ( it );
  }
  else if ( !str_cmp( type, "add" ) )
  {
	bool prefix = false, suffix = false;
	IMMORTAL_HOST *temp;
        int i;

  	smash_tilde( arg1 );
  	smash_tilde( arg2 );
  	name = arg2;
	
   	
  	if ( arg2[0] == '*' )
  	{
		prefix = true;
		name++;
  	}
 	
  	if ( name[strlen(name) -1] == '*' )
  	{
		suffix = true;
		name[strlen(name) -1] = '\0';
  	}
	
        arg1[0] = toupper(arg1[0]);
	for ( i = 0; i < (int) strlen( name ); i++ )
		name[i] = LOWER( name[i] );
	for ( temp = immortal_host_start; temp; temp = temp->next )
	{
		if ( !str_cmp ( temp->name, arg1 )  &&
		     !str_cmp ( temp->host, name ) )
		{
			send_to_char ("Entry already exists.\n\r", ch );
			return;
		}	
	}
  	CREATE ( host, IMMORTAL_HOST, 1 );
  	host->name = str_dup ( arg1 );
  	host->host = str_dup ( name );
        host->prefix = prefix;
        host->suffix = suffix;
  	LINK( host, immortal_host_start, immortal_host_end, next, prev );
  }
  else
  {
	send_to_char ("Syntax: immhost add    <name> <host>\n\r", ch );
	send_to_char ("Syntax: immhost delete <name> <host>\n\r", ch );
	send_to_char ("Syntax: immhost save\n\r", ch );
	return;
  }
  send_to_char ( "Done.\n\r", ch );  
  return;
}

void
do_write_imm_host ( void )
{
  IMMORTAL_HOST * temp;
  FILE	* fp;
  
  if ( immortal_host_start == NULL )
  {
	unlink ( IMM_HOST_FILE );
        return;
  }

  if ( ( fp = fopen ( IMM_HOST_FILE, "w" ) ) == NULL )
  {
	bug ("Do_write_imm_host: fopen", 0 );
	perror ( IMM_HOST_FILE );
	return;
  }
  
  for ( temp = immortal_host_start; temp; temp = temp->next )
  {
	fprintf (fp, "Start\n");
	fprintf (fp, "Name\t%s~\n", temp->name );
	fprintf (fp, "Host\t%s~\n", temp->host );
	if ( temp->prefix )
		fprintf (fp, "Prefix\t1\n" );
	if ( temp->suffix )
		fprintf (fp, "Suffix\t1\n" );
	fprintf (fp, "End\n" );
  }
  fprintf ( fp, "#END\n" );
  fclose( fp );
  return;
}


M src/interp.c => src/interp.c +1 -54
@@ 371,24 371,7 @@ void interpret( CHAR_DATA *ch, char *argument )
            }
	}

	/*
	 * Grab the command word.
	 * Special parsing so ' can be a command,
	 *   also no spaces needed after punctuation.
	 */
	strcpy( logline, argument );
/*
	if ( !isalpha(argument[0]) && !isdigit(argument[0])
		&& !str_cmp( argument[0], "'" ) )
	{
	    command[0] = argument[0];
	    command[1] = '\0';
	    argument++;
	    while ( isspace(*argument) )
		argument++;
	}
	else
*/

    argument = one_argument( argument, command );

	/*


@@ 416,9 399,6 @@ void interpret( CHAR_DATA *ch, char *argument )
	if ( !IS_NPC( ch ) && xIS_SET ( ch->act, PLR_AFK)  && (str_cmp(command, "AFK")))
	{
	    xREMOVE_BIT( ch->act, PLR_AFK );
/*
     	    act( AT_GREY, "$n is no longer afk.", ch, NULL, NULL, TO_ROOM );
*/
     	    act( AT_GREY, "$n is no longer afk.", ch, NULL, NULL, TO_CANSEE );
	}
    }


@@ 466,12 446,6 @@ void interpret( CHAR_DATA *ch, char *argument )
	if ( fLogAll && loglvl == LOG_NORMAL
	&&  (IS_NPC(ch) || !xIS_SET(ch->act, PLR_LOG)) )
	  loglvl = LOG_ALL;

	/* This is handled in get_trust already */
/*	if ( ch->desc && ch->desc->original )
	  log_string_plus( log_buf, loglvl,
		ch->desc->original->level );
	else*/
	  log_string_plus( log_buf, loglvl, get_trust(ch) );
    }



@@ 774,23 748,6 @@ void interpret( CHAR_DATA *ch, char *argument )
	    if ( !check_pos( ch, cmd->position ) )
		return;
    
    /* Berserk check for flee.. maybe add drunk to this?.. but too much
       hardcoding is annoying.. -- Altrag
       This wasn't catching wimpy --- Blod
    if ( !str_cmp(cmd->name, "flee") &&
          IS_AFFECTED(ch, AFF_BERSERK) )
    {
	send_to_char( "You aren't thinking very clearly..\n\r", ch);
	return;
    } */

    /*  So we can check commands for things like Posses and Polymorph
     *  But still keep the online editing ability.  -- Shaddai
     *  Send back the message to print out, so we have the option
     *  this function might be usefull elsewhere.  Also using the
     *  send_to_char_color so we can colorize the strings if need be. --Shaddai
     */

    buf = check_cmd_flags ( ch, cmd );

    if ( buf[0] != '\0'  ) {


@@ 834,8 791,6 @@ void interpret( CHAR_DATA *ch, char *argument )
	log_string_plus(log_buf, LOG_NORMAL, get_trust(ch));
	cmd->lag_count++;	/* count the lag flags */
    }

    tail_chain( );
}

CMDTYPE *find_command( char *command )


@@ 930,13 885,6 @@ bool check_social( CHAR_DATA *ch, char *command, char *argument )
    			LINK(victim, remfirst, remlast, next_in_room,
    				prev_in_room);
    		}
/*    		else
 *    		{
 *    			set_char_color(AT_IGNORE, victim);
 *    			ch_printf(victim, "You attempt to ignore %s,"
 *    				" but are unable to do so.\n\r", ch->name);
 *    		}
 */
    	}
    }



@@ 1124,7 1072,6 @@ char *one_argument( char *argument, char *arg_first )
	    argument++;
	    break;
	}
	//*arg_first = LOWER(*argument);
	*arg_first = *argument;
	arg_first++;
	argument++;

M src/space.c => src/space.c +14 -14
@@ 85,20 85,20 @@ char   *const bus_stop2[MAX_BUS_STOP2 + 1] =
};

/* local routines */
void fread_ship args((SHIP_DATA * ship, FILE *fp));
bool load_ship_file args((char *shipfile));
void write_ship_list args((void));
void fread_starsystem args((SPACE_DATA * starsystem, FILE *fp));
bool load_starsystem args((char *starsystemfile));
void write_starsystem_list args((void));
void landship args((SHIP_DATA * ship, char *arg));
void launchship args((SHIP_DATA * ship));
void echo_to_room_dnr args((int ecolor, ROOM_INDEX_DATA * room, char *argument));
bool 	autofly(SHIP_DATA * ship);
bool 	is_facing(SHIP_DATA * ship, SHIP_DATA * target);
void resetship args((SHIP_DATA * ship));
bool land_bus args((SHIP_DATA * ship, int destination));
void launch_bus args((SHIP_DATA * ship));
void fread_ship(SHIP_DATA * ship, FILE *fp);
bool load_ship_file(char *shipfile);
void write_ship_list(void);
void fread_starsystem(SPACE_DATA * starsystem, FILE *fp);
bool load_starsystem(char *starsystemfile);
void write_starsystem_list (void);
void landship (SHIP_DATA * ship, char *arg);
void launchship (SHIP_DATA * ship);
void echo_to_room_dnr (int ecolor, ROOM_INDEX_DATA * room, char *argument);
bool autofly(SHIP_DATA * ship);
bool is_facing(SHIP_DATA * ship, SHIP_DATA * target);
void resetship (SHIP_DATA * ship);
bool land_bus (SHIP_DATA * ship, int destination);
void launch_bus (SHIP_DATA * ship);
ch_ret 	drive_ship(CHAR_DATA * ch, SHIP_DATA * ship, EXIT_DATA * exit, int fall);

bool