/
LIB3/
LIB3/D/ADMIN/
LIB3/D/ADMIN/OBJ/
LIB3/D/ADMIN/ROOM/W/
LIB3/D/HOME/
LIB3/D/HOME/CITY/ARENA/
LIB3/D/HOME/CITY/ITEMS/
LIB3/D/HOME/CITY/POSTOFFI/
LIB3/DOC/
LIB3/GLOBAL/SPECIAL/
LIB3/GLOBAL/VIRTUAL/
LIB3/NET/
LIB3/NET/CONFIG/
LIB3/NET/DAEMON/CHARS/
LIB3/NET/GOPHER/
LIB3/NET/INHERIT/
LIB3/NET/OBJ/
LIB3/NET/SAVE/
LIB3/NET/VIRTUAL/
LIB3/OBJ/B_DAY/
LIB3/OBJ/HANDLERS/TERM_TYP/
LIB3/PLAYERS/B/
LIB3/PLAYERS/N/
LIB3/ROOM/
LIB3/SAVE/
LIB3/SAVE/BOARDS/
LIB3/SAVE/ENVIRON/
LIB3/SAVE/POST/
LIB3/STD/COMMANDS/SHADOWS/
LIB3/STD/CREATOR/
LIB3/STD/DOM/
LIB3/STD/EFFECTS/
LIB3/STD/EFFECTS/HEALING/
LIB3/STD/EFFECTS/OTHER/
LIB3/STD/EFFECTS/POISONS/
LIB3/STD/ENVIRON/
LIB3/STD/GUILDS/
LIB3/STD/LIQUIDS/
LIB3/STD/ROOM/
LIB3/STD/TRIGGER/SHADOW/
LIB3/W/
LIB3/W/BANNOR/
LIB3/W/NEWSTYLE/
inherit "/std/object";
#include "skills.h"
#include "commands.h"
#include "tune.h"

string *commands;
mixed   spells;
int     heal_loop;
string  start_pos;

void    create()
{
    commands = ({ });
    spells = ({ });
    start_pos = "/d/home/city/newbiepub1";
    ::create();
}

void    set_start_pos( string str )
{
    start_pos = str;
}
string  query_start_pos()
{
    return start_pos;
}

int     add_command( string name, int add_if_player )
{
    if( member_array( name, commands ) != -1 )
	return 0;
    commands += ({ name, ({ add_if_player }) });
    return 1;
}

int     remove_command( string name )
{
    int     i;

    if( (i = member_array( name, commands )) == -1 )
	return 0;
    commands = delete( commands, i, 1 );
    return 1;
}

int     do_command( string name, mixed param )
{
    mixed * tmp;

    if( member_array( name, commands ) )
	return 0;
    tmp = (mixed *)COMMAND_SERVER->query_command( name );
    return( int ) call_other( tmp[ 0 ], tmp[ 1 ], param );
}

int     add_spell( string name, object ob, string func_name, int add_if_player )
{
    if( member_array( name, spells ) != -1 )
	return 0;
    spells += ({ name, ({ ob, func_name, add_if_player }), });
    return 1;
}

int     remove_spell( string name )
{
    int     i;

    if( (i = member_array( name, spells )) == -1 )
	return 0;
    spells = delete( spells, i, 2 );
    return 1;
}

int     cast_spell( string name, mixed bing )
{
    int     i;

    if( (i = member_array( name, spells )) == -1 )
	return 0;
    return( int ) call_other( spells[ i + 1 ][ 0 ], spells[ i + 1 ][ 1 ], bing );
}

mixed   query_spells()
{
    return spells;
}
string *query_commands()
{
    return commands;
}

/* These 4 should be redefined in the guild object */
int     query_skill_cost( string skill )
{
    return 10;
}
int     query_skill_max_level( string skill )
{
    return 10;
}
string  query_title( object player )
{
    return "Ack! How the hell should I know?";
}
int     query_level( object ob )
{
    return( int ) ob->query_skill( "other" );
}

void    start_player( object pl )
{
    int     i;

    if( !spells )
	spells = ({ });
    for( i = 0; i < sizeof( spells ); i += 2 )
	if( spells[ i + 1 ][ 2 ] || !interactive( pl ) )
	    pl->add_spell( spells[ i ], spells[ i + 1 ][ 0 ], spells[ i + 1 ][ 1 ] );
    if( !commands )
	commands = ({ });
    for( i = 0; i < sizeof( commands ); i += 2 )
	if( commands[ i + 1 ][ 0 ] || !interactive( pl ) )
	    pl->add_known_command( commands[ i ] );
}

/* Are these 3 hooked up? */
void    leave_guild()
{
}
void    player_quit()
{
}
void    player_save()
{
}

/* Added by Newstyle, 28/10/93 */
string  new_mail_messages()
{
}
void player_heart_beat()
{
    int     bon;

    bon = (int)this_player()->query_con() * 5;
    if( (int)this_player()->query_hp() < 0 )
	this_player()->set_hp( 1 );
    if( bon < 40 )
	this_player()->adjust_hp( 1 );
    else
	this_player()->adjust_hp( bon / 40 );
/* Ack! This should refernce the primary stat, not Int! */
    bon = (int)this_player()->query_int() * 5;
    if( bon < 40 )
	this_player()->adjust_gp( 1 );
    else
	this_player()->adjust_gp( bon / 40 );
}

void    set_level( object ob, int lvl, string class )
{
    call_out( "set_new_level", 0, ({ ob, lvl, class }) );
}

void    set_new_level( mixed *arr )
{
    object  ob;
    int     lvl;

    ob = arr[ 0 ];
    lvl = arr[ 1 ];
    if( !ob )
	return;
    ob->add_skill_level( "fighting", lvl );
    ob->add_skill_level( "other", lvl );
    ob->add_skill_level( "magic", lvl );
    ob->add_skill_level( "faith", lvl );
    ob->add_skill_level( "occult", lvl );
    ob->set_int( 13 );
    ob->set_dex( 13 );
    ob->set_wis( 13 );
    ob->set_con( 13 );
    ob->set_str( 13 );
    ob->set_hp( 100000 );
    ob->set_gp( 100000 );
    ob->reset_all();
}