area/
build/testing/
log/
player/
player/backup/
/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/
#include <glib.h>

#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>
#include <interp.h>

/*
 * Hunter stuff to go here :P
 */
 
 
/* Make a new Hunter*/
void do_convert( CHAR_DATA* ch, char *argument)
{
	CHAR_DATA *victim;
	char      arg [MAX_INPUT_LENGTH];
	char      buf [MAX_INPUT_LENGTH];
	bool      can_sire = FALSE;
	
	argument = one_argument( argument, arg );
	
	if (IS_NPC(ch)) return;

	if (!IS_IMMORTAL(ch) && !IS_CLASS(ch,CLASS_HUNTER))
    {
        send_to_char("Huh?",ch);
    }

    if (IS_IMMORTAL(ch) && ch->level <= LEVEL_HIGHJUDGE) 
    {
    	send_to_char("Huh?\n\r",ch);
		return;
    }

    if (IS_SET(ch->special, SPC_BETA)
        ||  IS_SET(ch->special, SPC_PRINCE)) can_sire = TRUE;
	else can_sire = FALSE;

	
	if (!can_sire)
	{
		send_to_char("You are unable to convert them.\n\r",ch);
		return;
	}
	
	if ( arg[0] == '\0' )
	{
		send_to_char( "Convert whom?\n\r", ch );
		return;
	}
	
	if ( ( victim = get_char_room( ch, arg ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return;
	}
	
	if ( IS_NPC(victim) )
	{
		send_to_char( "Not on NPC's.\n\r", ch );
		return;
	}
	
	if ( IS_IMMORTAL(victim) )
	{
		send_to_char( "Not on Immortal's.\n\r", ch );
		return;
	}
	
	if ( ch == victim )
	{
		send_to_char( "You cannot convert yourself.\n\r", ch );
		return;
	}
	
	if (IS_CLASS(victim, CLASS_MAGE))
	{
		send_to_char( "You cannot bite mages.\n\r", ch );
		return;
	}
	
	if ( victim->level != LEVEL_AVATAR && !IS_IMMORTAL(victim) )
	{
		send_to_char( "You can only claw avatars.\n\r", ch );
		return;
	}

        if (HAS_DELAY(victim) || HAS_DELAY(ch))
        {
                send_to_char( "Not with a wait timer...\n\r", ch );
                return;
        }
	
	if (IS_CLASS(victim, CLASS_VAMPIRE) || IS_SET(victim->pcdata->stats[UNI_AFF], VAM_MORTAL))
	{
		send_to_char( "You are unable to create werevamps!\n\r", ch );
		return;
	}

	if (IS_SWWF(victim))
	{
		send_to_char("Do I really have to tell you that you can't do this?\n\r",ch);
		return;
	}


	if ( IS_CLASS(victim, CLASS_WEREWOLF))
	{
		send_to_char( "No, accaully they aready choose thier path.\n\r", ch );
		return;
	}
	
	if (IS_IMMUNE(victim,IMM_WEREWOLF))
	{
		send_to_char( "You cannot convert an unwilling person.\n\r", ch );
		return;
	}
	
	if (ch->exp < 1000000)
	{
		send_to_char("You cannot afford the 1000000 exp to pass on the gift.\n\r",ch);
		return;
	}
	
	ch->exp = ch->exp - 1000000;
	if (ch->pcdata->stats[UNI_CURRENT] < 1) ch->pcdata->stats[UNI_CURRENT] = 1;
	else ch->pcdata->stats[UNI_CURRENT] += 1;
	if (IS_SET(ch->special,SPC_SIRE)) REMOVE_BIT(ch->special,SPC_SIRE);

	victim->creature=CLASS_HUNTER;
	send_to_char( "\n\rYou are now a hunter.\n\r", victim );
	
    if (IS_IMMORTAL(ch))
		victim->pcdata->stats[UNI_GEN] = 3;
	else
		victim->pcdata->stats[UNI_GEN] = ch->pcdata->stats[UNI_GEN] + 1;
	if (ch->pcdata->stats[UNI_GEN] == 1)
		victim->lord = g_string_assign(victim->lord,ch->name->str);
	else
	{
		sprintf(buf,"%s %s",ch->lord->str,ch->name->str);
		victim->lord = g_string_assign(victim->lord,buf);
	}
	
	if (!IS_IMMORTAL(ch))
		victim->clan= ch->clan;
    else
        victim->clan = CLAN_LEOPOLD;
	
    victim->pcdata->stats[UNI_AFF] = 0;
	victim->pcdata->stats[UNI_CURRENT] = 0;
	
    save_char_obj(ch);
	save_char_obj(victim);
	
	if (IS_IMMORTAL(ch))
		victim->sect = SECT_SOCIETY_LEO;
	else
		victim->sect = ch->sect;
	
	return;

}
void do_hunter( CHAR_DATA *ch, char *argument )
{
	char      arg [MAX_INPUT_LENGTH];
	argument = one_argument( argument, arg );
	
	if (IS_NPC(ch)) return;
	
	if (IS_IMMUNE(ch, IMM_WEREWOLF))
	{
		send_to_char("You will now allow hunters to convert you.\n\r",ch);
		REMOVE_BIT(ch->immune, IMM_WEREWOLF);
		return;
	}
	send_to_char("You will no longer allow hunters to convert you.\n\r",ch);
	SET_BIT(ch->immune, IMM_WEREWOLF);
	return;
}