
#include "items\item.inl"

#include "items\gigai.inl"
#include "items\injection.inl"
#include "items\mantle.inl"

//---------------------------------------------------------------------

/*
ITEM ID:
1 = gigai
2 = injection
3 = mantle
*/

public item_check(id,cost)
{
	if(!is_user_alive(id))
	{
		client_print(id,print_chat,"%L",id,"L_ITEM_B_ALIVE",PLUGIN_TAG);
	}
	else if(!cs_get_user_buyzone(id))
	{
		client_print(id,print_chat,"%L",id,"L_ITEM_B_ZONE",PLUGIN_TAG);
	}
	else if(!g_event_buy_time)
	{
		client_print(id,print_chat,"%L",id,"L_ITEM_B_TIME",PLUGIN_TAG);
	}
	else if(cs_get_user_money(id) <= cost)
	{
		client_print(id,print_chat,"%L",id,"L_ITEM_NOT_ENOUGH",PLUGIN_TAG);
	}
	else if(g_player_item[id] > 0)
	{
		client_print(id,print_chat,"%L",id,"L_ITEM_HAVE",PLUGIN_TAG);
	}
	else
	{
		return true;
	}
	
	return false;
}

public item_use(id)
{
	if(g_player_item_in_use[id])
	{
		print_hud_status(id,"%L",id,"L_STATUS_ITEM_IN_USE");
		return PLUGIN_CONTINUE;
	}
	else if(g_event_freeze_time || g_event_round_end)
	{
		client_print(id,print_chat,"%L",id,"L_ITEM_BLOCK_USE",PLUGIN_TAG);
		return PLUGIN_CONTINUE;
	}
	
	switch(g_player_item[id])
	{
		case 1:
		{
			item_gigai(id);
		}
		case 2:
		{
			item_injection(id);
		}
	}
	print_hud_player(id);
	
	return PLUGIN_CONTINUE;
}

public item_passive(id)
{
	switch(g_player_item[id])
	{
		case 3:
		{
			validate_gravity(id);
		}
	}
	
	return PLUGIN_CONTINUE;
}

public item_reset(id)
{
	switch(g_player_item[id])
	{
		case 1:
		{
			item_gigai_remove(id);
		}
		case 3:
		{
			item_mantle_reset(id);
		}
	}
	
	g_player_item_in_use[id]=false;
}
