/
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/
#pragma save_binary
static int intbon, dexbon, conbon, strbon, wisbon;
int     Dex, Int, Con, Str, Wis, inttmp, dextmp, contmp, wistmp, strtmp;
static int no_check;

int     query_no_check()
{
    return no_check;
}
void    set_no_check( int i )
{
    no_check = i;
}

int     check( int i )
{
    if( i > 28 )
	return 0;
    return 1;
}

void    reset_hp()
{
    if( no_check )
	return;
    this_object()->set_max_hp( 
				  500 + (int)this_object()->query_skill_bonus( "combat.stamina" ) * 10 );
}

void    reset_gp()
{
    object  guild_ob;

    if( no_check )
	return;
    guild_ob = (object)this_object()->query_guild_ob();
    if( !guild_ob )
	this_object()->set_max_gp( 
				      50 + (int)this_object()->query_skill_bonus( "general.points" ) );
    else
	guild_ob->set_gp( this_object() );
}

void    reset_carry_cap()
{
    int     old_cap, cap, st;
    object  ob1, ob2;

    if( no_check )
	return;
    old_cap = (int)this_object()->query_loc_weight();

    st = Str + strtmp + strbon;
    cap = 6 * st * st;
    if( cap < 500 )
	cap = 500;

    this_object()->set_max_weight( cap );
    if( cap >= old_cap )
	return;
    ob1 = first_inventory( this_object() );
    while( ob1 )
    {
	ob2 = next_inventory( ob1 );
	if( ob1->query_weight() )
	    if( ob1->move( environment() ) )
	    {
		old_cap -= (int)ob1->query_weight();
		say( this_object()->query_cap_name() + " drops " + ob1->short() +
		     ", looking strained.\n" );
		write( "In your weakness you drop " + ob1->short() + ".\n" );
	    }
	if( cap >= old_cap )
	    return;
	ob1 = ob2;
    }
}

void    reset_all()
{
    call_out( "zap_stat_cache", 0, "SDIWC" );
    call_out( "reset_all2", 0 );
}

void    reset_all2()
{
    no_check = 0;
    reset_hp();
    reset_gp();
    reset_carry_cap();
}

int     set_str( int i )
{
    if( i > 28 )
	i = 28;
    if( Str != i )
	call_out( "zap_stat_cache", 0, "S" );
    Str = i;
    reset_carry_cap();
    return 1;
}

int     set_con( int i )
{
    if( i > 28 )
	i = 28;
    if( Con != i )
	call_out( "zap_stat_cache", 0, "C" );
    Con = i;
    call_out( "reset_hp", 2 );
    return 1;
}

int     set_int( int i )
{
    if( i > 28 )
	i = 28;
    if( Int != i )
	call_out( "zap_stat_cache", 0, "I" );
    Int = i;
    call_out( "reset_gp", 2 );
    return 1;
}

int     set_dex( int i )
{
    if( i > 28 )
	i = 28;
    if( Dex != i )
	call_out( "zap_stat_cache", 0, "D" );
    Dex = i;
    return 1;
}

int     set_wis( int i )
{
    if( i > 28 )
	i = 28;
    if( Wis != i )
	call_out( "zap_stat_cache", 0, "W" );
    Wis = i;
    call_out( "reset_gp", 2 );
    return 1;
}

int     query_str()
{
    return Str + strtmp + strbon;
}
int     query_int()
{
    return Int + inttmp + intbon;
}
int     query_dex()
{
    return Dex + dextmp + dexbon;
}
int     query_wis()
{
    return Wis + wistmp + wisbon;
}
int     query_con()
{
    return Con + contmp + conbon;
}

int     query_real_str()
{
    return Str;
}
int     query_real_int()
{
    return Int;
}
int     query_real_dex()
{
    return Dex;
}
int     query_real_wis()
{
    return Wis;
}
int     query_real_con()
{
    return Con;
}

int     query_tmp_str()
{
    return strtmp;
}
int     query_tmp_int()
{
    return inttmp;
}
int     query_tmp_dex()
{
    return dextmp;
}
int     query_tmp_wis()
{
    return wistmp;
}
int     query_tmp_con()
{
    return contmp;
}

int     query_bonus_str()
{
    return strbon;
}
int     query_bonus_int()
{
    return intbon;
}
int     query_bonus_dex()
{
    return dexbon;
}
int     query_bonus_wis()
{
    return wisbon;
}
int     query_bonus_con()
{
    return conbon;
}

int     adjust_dex( int i )
{
    Dex += i;
    if( Dex > 28 )
	Dex = 28;
    if( i )
	call_out( "zap_stat_cache", 0, "D" );
    return Dex;
}

int     adjust_con( int i )
{
    Con += i;
    if( Con > 28 )
	Con = 28;
    if( i )
	call_out( "zap_stat_cache", 0, "C" );
    call_out( "reset_hp", 2 );
    return Con;
}

int     adjust_str( int i )
{
    Str += i;
    if( Str > 28 )
	Str = 28;
    if( i )
	call_out( "zap_stat_cache", 0, "S" );
    reset_carry_cap();
    return Str;
}

int     adjust_wis( int i )
{
    Wis += i;
    if( Wis > 28 )
	Wis = 28;
    if( i )
	call_out( "zap_stat_cache", 0, "W" );
    call_out( "reset_gp", 2 );
    return Wis;
}

int     adjust_int( int i )
{
    Int += i;
    if( Int > 28 )
	Int = 28;
    if( i )
	call_out( "zap_stat_cache", 0, "I" );
    call_out( "reset_gp", 2 );
    return Int;
}

int     adjust_tmp_int( int i )
{
    inttmp += i;
    if( i )
	call_out( "zap_stat_cache", 0, "I" );
    call_out( "reset_gp", 2 );
    return inttmp;
}

int     adjust_tmp_dex( int i )
{
    dextmp += i;
    if( i )
	call_out( "zap_stat_cache", 0, "D" );
    return dextmp;
}

int     adjust_tmp_wis( int i )
{
    wistmp += i;
    if( i )
	call_out( "zap_stat_cache", 0, "W" );
    call_out( "reset_gp", 2 );
    return wistmp;
}

int     adjust_tmp_str( int i )
{
    strtmp += i;
    if( i )
	call_out( "zap_stat_cache", 0, "S" );
    reset_carry_cap();
    return strtmp;
}

int     adjust_tmp_con( int i )
{
    contmp += i;
    if( i )
	call_out( "zap_stat_cache", 0, "C" );
    call_out( "reset_hp", 2 );
    return contmp;
}

int     adjust_bonus_int( int i )
{
    intbon += i;
    if( i )
	call_out( "zap_stat_cache", 0, "I" );
    call_out( "reset_gp", 2 );
    return intbon;
}

int     adjust_bonus_dex( int i )
{
    dexbon += i;
    if( i )
	call_out( "zap_stat_cache", 0, "D" );
    return dexbon;
}

int     adjust_bonus_wis( int i )
{
    wisbon += i;
    if( i )
	call_out( "zap_stat_cache", 0, "W" );
    call_out( "reset_gp", 2 );
    return wisbon;
}

int     adjust_bonus_str( int i )
{
    strbon += i;
    if( i )
	call_out( "zap_stat_cache", 0, "S" );
    reset_carry_cap();
    return strbon;
}

int     adjust_bonus_con( int i )
{
    conbon += i;
    if( i )
	call_out( "zap_stat_cache", 0, "C" );
    call_out( "reset_hp", 2 );
    return conbon;
}

int     set_bonus_int( int i )
{
    intbon = i;
    if( i )
	call_out( "zap_stat_cache", 0, "I" );
    call_out( "reset_gp", 2 );
    return intbon;
}

int     set_bonus_dex( int i )
{
    dexbon = i;
    if( i )
	call_out( "zap_stat_cache", 0, "D" );
    return dexbon;
}

int     set_bonus_wis( int i )
{
    wisbon = i;
    if( i )
	call_out( "zap_stat_cache", 0, "W" );
    call_out( "reset_gp", 2 );
    return wisbon;
}

int     set_bonus_str( int i )
{
    strbon = i;
    if( i )
	call_out( "zap_stat_cache", 0, "S" );
    reset_carry_cap();
    return strbon;
}

int     set_bonus_con( int i )
{
    conbon = i;
    if( i )
	call_out( "zap_stat_cache", 0, "C" );
    call_out( "reset_hp", 2 );
    return conbon;
}

void    update_tmps()
{
    if( strtmp )
    {
	call_out( "zap_stat_cache", 0, "S" );
	strtmp = strtmp / 2;
	reset_carry_cap();
    }
    if( contmp )
    {
	call_out( "zap_stat_cache", 0, "C" );
	contmp = contmp / 2;
	call_out( "reset_hp", 2 );
    }
    if( wistmp )
    {
	call_out( "zap_stat_cache", 0, "W" );
	wistmp = wistmp / 2;
	call_out( "reset_gp", 2 );
    }
    if( inttmp )
    {
	call_out( "zap_stat_cache", 0, "I" );
	inttmp = inttmp / 2;
	call_out( "reset_gp", 2 );
    }
    if( dextmp )
    {
	call_out( "zap_stat_cache", 0, "D" );
	dextmp = dextmp / 2;
    }
}

string  stat_string( int i )
{
    if( i < 19 )
	return i + "";
    if( i > 28 )
	return( i - 10 ) + "";
    if( i == 28 )
	return "18/00";
    return "18/" + (i - 18) + "0";
}